Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: rockchip-inno-usb2: Make use of the helper function devm_add_action_or_reset()

The helper function devm_add_action_or_reset() will internally
call devm_add_action(), and gif devm_add_action() fails then it will
execute the action mentioned and return the error code. So
use devm_add_action_or_reset() instead of devm_add_action()
to simplify the error handling, reduce the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210922130024.745-1-caihuoqing@baidu.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Cai Huoqing and committed by
Vinod Koul
717e04fb 6ae6942f

+2 -9
+2 -9
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
··· 321 321 struct device_node *node = rphy->dev->of_node; 322 322 struct clk_init_data init; 323 323 const char *clk_name; 324 - int ret; 324 + int ret = 0; 325 325 326 326 init.flags = 0; 327 327 init.name = "clk_usbphy_480m"; ··· 352 352 if (ret < 0) 353 353 goto err_clk_provider; 354 354 355 - ret = devm_add_action(rphy->dev, rockchip_usb2phy_clk480m_unregister, 356 - rphy); 357 - if (ret < 0) 358 - goto err_unreg_action; 355 + return devm_add_action_or_reset(rphy->dev, rockchip_usb2phy_clk480m_unregister, rphy); 359 356 360 - return 0; 361 - 362 - err_unreg_action: 363 - of_clk_del_provider(node); 364 357 err_clk_provider: 365 358 clk_unregister(rphy->clk480m); 366 359 err_ret: