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] [day] [month] [year] [list]
Message-ID: <CAPDyKFrGxH_q1V5=oqfcK84xCcXzWQ-v_XcfZPPj+i048Tv=bQ@mail.gmail.com>
Date: Fri, 13 Sep 2024 13:15:48 +0200
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Shen Lichuan <shenlichuan@...o.com>
Cc: florian.fainelli@...adcom.com, rjui@...adcom.com, sbranden@...adcom.com, 
	bcm-kernel-feedback-list@...adcom.com, linux-pm@...r.kernel.org, 
	linux-rpi-kernel@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org, 
	linux-kernel@...r.kernel.org, opensource.kernel@...o.com
Subject: Re: [PATCH v1] pmdomain: bcm: Simplify with dev_err_probe()

On Fri, 30 Aug 2024 at 13:04, Shen Lichuan <shenlichuan@...o.com> wrote:
>
> Use dev_err_probe() to simplify the error path and unify a message
> template.

In this case the simplification is questionable, I think.

>
> Using this helper is totally fine even if err is known to never
> be -EPROBE_DEFER.
>
> The benefit compared to a normal dev_err() is the standardized format
> of the error code, it being emitted symbolically and the fact that
> the error code is returned which allows more compact error paths.

Right, which I guess boils down to what people preferes.

That said, my take on this is that we should move from dev_err() to
dev_err_probe(), at least there needs to be some simplification
involved too.

Kind regards
Uffe

>
> Signed-off-by: Shen Lichuan <shenlichuan@...o.com>
> ---
>  drivers/pmdomain/bcm/bcm2835-power.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/pmdomain/bcm/bcm2835-power.c b/drivers/pmdomain/bcm/bcm2835-power.c
> index d2f0233cb620..be07ab8a663c 100644
> --- a/drivers/pmdomain/bcm/bcm2835-power.c
> +++ b/drivers/pmdomain/bcm/bcm2835-power.c
> @@ -643,18 +643,16 @@ static int bcm2835_power_probe(struct platform_device *pdev)
>         power->rpivid_asb = pm->rpivid_asb;
>
>         id = readl(power->asb + ASB_AXI_BRDG_ID);
> -       if (id != BCM2835_BRDG_ID /* "BRDG" */) {
> -               dev_err(dev, "ASB register ID returned 0x%08x\n", id);
> -               return -ENODEV;
> -       }
> +       if (id != BCM2835_BRDG_ID /* "BRDG" */)
> +               return dev_err_probe(dev, -ENODEV,
> +                                    "ASB register ID returned 0x%08x\n", id);
>
>         if (power->rpivid_asb) {
>                 id = readl(power->rpivid_asb + ASB_AXI_BRDG_ID);
> -               if (id != BCM2835_BRDG_ID /* "BRDG" */) {
> -                       dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n",
> -                                    id);
> -                       return -ENODEV;
> -               }
> +               if (id != BCM2835_BRDG_ID /* "BRDG" */)
> +                       return dev_err_probe(dev, -ENODEV,
> +                                            "RPiVid ASB register ID returned 0x%08x\n",
> +                                            id);
>         }
>
>         power->pd_xlate.domains = devm_kcalloc(dev,
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ