mbox series

[linux-next,0/5] Use dev_err_probe() in phy

Message ID 20250402194100610qY6KQ4JPISk-4v214Qs36@zte.com.cn
Headers show
Series Use dev_err_probe() in phy | expand

Message

shao.mingyin@zte.com.cn April 2, 2025, 11:41 a.m. UTC
From: Zhang Enpei <zhang.enpei@zte.com.cn>

Use dev_err_probe() to simplify the following code
sequence:
  if (err != -EPROBE_DEFER)
      dev_err(dev, ...);
  else
      dev_dbg(dev, ...);
  return err;

Zhang Enpei (5):
  phy: allwinner: phy-sun50i-usb3: Use dev_err_probe()
  phy: broadcom: phy-bcm63xx-usbh: Use dev_err_probe()
  phy: qualcomm: phy-qcom-ipq4019-usb: Use dev_err_probe()
  phy: lantiq: phy-lantiq-rcu-usb2: Use dev_err_probe()
  phy: rockchip: phy-rockchip-typec: Use dev_err_probe()

 drivers/phy/allwinner/phy-sun50i-usb3.c     | 8 +++-----
 drivers/phy/broadcom/phy-bcm63xx-usbh.c     | 8 +++-----
 drivers/phy/lantiq/phy-lantiq-rcu-usb2.c    | 8 +++-----
 drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c | 8 +++-----
 drivers/phy/rockchip/phy-rockchip-typec.c   | 8 +++-----
 5 files changed, 15 insertions(+), 25 deletions(-)

Comments

Sebastian Reichel April 5, 2025, 11:03 p.m. UTC | #1
Hi,

On Wed, Apr 02, 2025 at 07:45:42PM +0800, shao.mingyin@zte.com.cn wrote:
> From: Zhang Enpei <zhang.enpei@zte.com.cn>
> 
> Replace the open-code with dev_err_probe() to simplify the code.
> 
> Signed-off-by: Zhang Enpei <zhang.enpei@zte.com.cn>
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
> ---
>  drivers/phy/rockchip/phy-rockchip-typec.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
> index d9701b6106d5..94d1e6ead1a7 100644
> --- a/drivers/phy/rockchip/phy-rockchip-typec.c
> +++ b/drivers/phy/rockchip/phy-rockchip-typec.c
> @@ -1151,11 +1151,9 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
>  	if (IS_ERR(tcphy->extcon)) {
>  		if (PTR_ERR(tcphy->extcon) == -ENODEV) {
>  			tcphy->extcon = NULL;
> -		} else {
> -			if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER)
> -				dev_err(dev, "Invalid or missing extcon\n");
> -			return PTR_ERR(tcphy->extcon);
> -		}
> +		} else
> +			return dev_err_probe(dev, PTR_ERR(tcphy->extcon),
> +					     "Invalid or missing extcon\n");

You should also remove the { } for the normal if clause. Otherwise

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>

But you might want to throw in an extra patch updating the error
message. -ENODEV is covered explicitly, so it's not "missing". I
suggest "Failed to get extcon".

Greetings,

-- Sebastian

>  	}
> 
>  	pm_runtime_enable(dev);
> -- 
> 2.25.1
>