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: <f8f4494f-3d6c-f9b3-68fe-9ae3a5f345c6@microchip.com>
Date:   Wed, 17 Mar 2021 19:38:45 +0100
From:   Nicolas Ferre <nicolas.ferre@...rochip.com>
To:     Michael Tretter <m.tretter@...gutronix.de>,
        <netdev@...r.kernel.org>
CC:     <claudiu.beznea@...rochip.com>, <davem@...emloft.net>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] net: macb: simplify clk_init with dev_err_probe

On 17/03/2021 at 17:16, Michael Tretter wrote:
> On some platforms, e.g., the ZynqMP, devm_clk_get can return
> -EPROBE_DEFER if the clock controller, which is implemented in firmware,
> has not been probed yet.
> 
> As clk_init is only called during probe, use dev_err_probe to simplify
> the error message and hide it for -EPROBE_DEFER.
> 
> Signed-off-by: Michael Tretter <m.tretter@...gutronix.de>

Looks good to me:
Acked-by: Nicolas Ferre <nicolas.ferre@...rochip.com>

Thanks Michael, regards,
   Nicolas

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 20 +++++++++-----------
>   1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index e7c123aadf56..f56f3dbbc015 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -3758,17 +3758,15 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
>                  *hclk = devm_clk_get(&pdev->dev, "hclk");
>          }
> 
> -       if (IS_ERR_OR_NULL(*pclk)) {
> -               err = IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV;
> -               dev_err(&pdev->dev, "failed to get macb_clk (%d)\n", err);
> -               return err;
> -       }
> -
> -       if (IS_ERR_OR_NULL(*hclk)) {
> -               err = IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV;
> -               dev_err(&pdev->dev, "failed to get hclk (%d)\n", err);
> -               return err;
> -       }
> +       if (IS_ERR_OR_NULL(*pclk))
> +               return dev_err_probe(&pdev->dev,
> +                                    IS_ERR(*pclk) ? PTR_ERR(*pclk) : -ENODEV,
> +                                    "failed to get pclk\n");
> +
> +       if (IS_ERR_OR_NULL(*hclk))
> +               return dev_err_probe(&pdev->dev,
> +                                    IS_ERR(*hclk) ? PTR_ERR(*hclk) : -ENODEV,
> +                                    "failed to get hclk\n");
> 
>          *tx_clk = devm_clk_get_optional(&pdev->dev, "tx_clk");
>          if (IS_ERR(*tx_clk))
> --
> 2.29.2
> 


-- 
Nicolas Ferre

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ