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>] [day] [month] [year] [list]
Message-ID: <4d505dd3-b289-4191-95f2-4a6eaa647e81@microchip.com>
Date:   Fri, 10 Nov 2023 21:13:43 +0100
From:   Aubin Constans <aubin.constans@...rochip.com>
To:     Markus Elfring <Markus.Elfring@....de>,
        Julia Lawall <Julia.Lawall@...ia.fr>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Beznea <claudiu.beznea@...on.dev>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        <linux-mmc@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <kernel-janitors@...r.kernel.org>
CC:     <cocci@...ia.fr>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mmc: atmel-mci: Use common error handling code in
 atmci_of_init()

On 05/11/2023 16:50, Markus Elfring wrote:
> Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>

Acked-by: Aubin Constans <aubin.constans@...rochip.com>

> ---
>   drivers/mmc/host/atmel-mci.c | 18 ++++++++++--------
>   1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index dba826db739a..1e83119d1dcb 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -675,10 +675,9 @@ atmci_of_init(struct platform_device *pdev)
>                                                "cd", GPIOD_IN, "cd-gpios");
>                  err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].detect_pin);
>                  if (err) {
> -                       if (err != -ENOENT) {
> -                               of_node_put(cnp);
> -                               return ERR_PTR(err);
> -                       }
> +                       if (err != -ENOENT)
> +                               goto put_node;
> +
>                          pdata->slot[slot_id].detect_pin = NULL;
>                  }
> 
> @@ -690,15 +689,18 @@ atmci_of_init(struct platform_device *pdev)
>                                                "wp", GPIOD_IN, "wp-gpios");
>                  err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].wp_pin);
>                  if (err) {
> -                       if (err != -ENOENT) {
> -                               of_node_put(cnp);
> -                               return ERR_PTR(err);
> -                       }
> +                       if (err != -ENOENT)
> +                               goto put_node;
> +
>                          pdata->slot[slot_id].wp_pin = NULL;
>                  }
>          }
> 
>          return pdata;
> +
> +put_node:
> +       of_node_put(cnp);
> +       return ERR_PTR(err);
>   }
>   #else /* CONFIG_OF */
>   static inline struct mci_platform_data*
> --
> 2.42.0
> 

Best regards,
Aubin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ