lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <kluyezsiuntl635hlc2lgnbxytmhirt6ej5txcoleaakdw27nm@zami2pb2bmn5>
Date: Wed, 28 Aug 2024 16:14:20 +0000
From: Alvin Šipraga <ALSI@...g-olufsen.dk>
To: Hongbo Li <lihongbo22@...wei.com>
CC: "linus.walleij@...aro.org" <linus.walleij@...aro.org>, "andrew@...n.ch"
	<andrew@...n.ch>, "f.fainelli@...il.com" <f.fainelli@...il.com>,
	"olteanv@...il.com" <olteanv@...il.com>, "davem@...emloft.net"
	<davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net: dsa: realtek: make use of
 dev_err_cast_probe()

On Wed, Aug 28, 2024 at 08:18:05PM GMT, Hongbo Li wrote:
> Using dev_err_cast_probe() to simplify the code.
> 
> Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
> ---
>  drivers/net/dsa/realtek/rtl83xx.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/dsa/realtek/rtl83xx.c b/drivers/net/dsa/realtek/rtl83xx.c
> index 35709a1756ae..3c5018d5e1f9 100644
> --- a/drivers/net/dsa/realtek/rtl83xx.c
> +++ b/drivers/net/dsa/realtek/rtl83xx.c
> @@ -185,11 +185,9 @@ rtl83xx_probe(struct device *dev,
> 
>         /* TODO: if power is software controlled, set up any regulators here */
>         priv->reset_ctl = devm_reset_control_get_optional(dev, NULL);
> -       if (IS_ERR(priv->reset_ctl)) {
> -               ret = PTR_ERR(priv->reset_ctl);
> -               dev_err_probe(dev, ret, "failed to get reset control\n");
> -               return ERR_CAST(priv->reset_ctl);
> -       }
> +       if (IS_ERR(priv->reset_ctl))
> +               return dev_err_cast_probe(dev, priv->reset_ctl,
> +                                         "failed to get reset control\n");

The change is fine, but maybe it would be nice to fix up the other two
similar cases as well? The errors would be stringified but that's OK.

   159          rc.lock_arg = priv;
   160          priv->map = devm_regmap_init(dev, NULL, priv, &rc);
   161          if (IS_ERR(priv->map)) {
   162                  ret = PTR_ERR(priv->map);
   163                  dev_err(dev, "regmap init failed: %d\n", ret);
   164                  return ERR_PTR(ret);
   165          }
   166  
   167          rc.disable_locking = true;
   168          priv->map_nolock = devm_regmap_init(dev, NULL, priv, &rc);
   169          if (IS_ERR(priv->map_nolock)) {
   170                  ret = PTR_ERR(priv->map_nolock);
   171                  dev_err(dev, "regmap init failed: %d\n", ret);
   172                  return ERR_PTR(ret);
   173          }

Then you can remove the ret variable altogether.

Either way,

Reviewed-by: Alvin Šipraga <alsi@...g-olufsen.dk>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ