phy: Use PTR_ERR_OR_ZERO to replace the open code
cover phy: Use PTR_ERR_OR_ZERO to replace the open code
The issue is detected with the help of Coccinelle.
zhong jiang (2):
phy:phy-brcm-us: Use PTR_ERR_OR_ZERO to replace the open code phy:phy-lantiq-rcu-usb2: Use PTR_ERR_OR_ZERO to replace the open code
drivers/phy/broadcom/phy-brcm-usb.c | 4 +--- drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.12.4
PATCH 1/2 phy:phy-brcm-us: Use PTR_ERR_OR_ZERO to replace the open code
PTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So just replace them rather than duplicating its implement.
--- drivers/phy/broadcom/phy-brcm-usb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/phy/broadcom/phy-brcm-usb.c +1 -3
@@ -372,10 +372,8 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)clk_disable (priv->usb_30_clk); phy_provider =devm_of_phy_provider_register (dev, brcm_usb_phy_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); -return 0 ; +return PTR_ERR_OR_ZERO (phy_provider); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
1.7.12.4
Re: [PATCH 1/2] phy:phy-brcm-us: Use PTR_ERR_OR_ZERO to replace the open code
Quoted 2 lines · zhong jiang
PTR_ERR_OR_ZEROhas implemented the if(IS_ERR(...)) +PTR_ERR, So just replace them rather than duplicating its implement.
Subject should be:
phy: phy-brcm-usb: Use PTR_ERR_OR_ZERO to replace open coded version
Thank you
Quoted 23 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/phy/broadcom/phy-brcm-usb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/phy/broadcom/phy-brcm-usb.c +1
-3@@ -372,10 +372,8 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)clk_disable (priv->usb_30_clk); phy_provider =devm_of_phy_provider_register (dev, brcm_usb_phy_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); -return 0 ; +return PTR_ERR_OR_ZERO (phy_provider); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
Florian
Re: [PATCH 1/2] phy:phy-brcm-us: Use PTR_ERR_OR_ZERO to replace the open code
Quoted 6 lines · Florian Fainelli
Quoted 2 lines · zhong jiang
PTR_ERR_OR_ZEROhas implemented the if(IS_ERR(...)) +PTR_ERR, So just replace them rather than duplicating its implement.Subject should be:
phy: phy-brcm-usb: Use
PTR_ERR_OR_ZEROto replace open coded version
Thank you for tips. It is my mistake.:-[
Sincerely,
zhong jiang
Quoted 25 lines
Thank you
Quoted 22 lines
Signed-off-by zhong jiang <[email protected]>--- drivers/phy/broadcom/phy-brcm-usb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/phy/broadcom/phy-brcm-usb.c +1
-3@@ -372,10 +372,8 @@ static int brcm_usb_phy_probe(struct platform_device *pdev)clk_disable (priv->usb_30_clk); phy_provider =devm_of_phy_provider_register (dev, brcm_usb_phy_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); -return 0 ; +return PTR_ERR_OR_ZERO (phy_provider); }#ifdef CONFIG_PM_SLEEP
PATCH 2/2 phy:phy-lantiq-rcu-usb2: Use PTR_ERR_OR_ZERO to replace the open code
In reply to zhong jiangPTR_ERR_OR_ZERO has implemented the if(IS_ERR(...)) + PTR_ERR, So just replace them rather than duplicating its implement.
--- drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/phy/lantiq/phy-lantiq-rcu-usb2.c +1 -3
@@ -196,10 +196,8 @@ static int ltq_rcu_usb2_of_parse(struct ltq_rcu_usb2_priv *priv, } priv->phy_reset =devm_reset_control_get_optional (dev,"phy" ); -if (IS_ERR (priv->phy_reset)) -return PTR_ERR (priv->phy_reset); -return 0 ; +return PTR_ERR_OR_ZERO (priv->phy_reset); }static int ltq_rcu_usb2_phy_probe (struct platform_device *pdev)
Signature · 1 line
1.7.12.4