From: Aubin Constans <aubin.constans@microchip.com>
To: Markus Elfring <Markus.Elfring@web.de>,
Julia Lawall <Julia.Lawall@inria.fr>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Ulf Hansson <ulf.hansson@linaro.org>, <linux-mmc@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<kernel-janitors@vger.kernel.org>
Cc: <cocci@inria.fr>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mmc: atmel-mci: Use common error handling code in atmci_of_init()
Date: Fri, 10 Nov 2023 21:13:43 +0100 [thread overview]
Message-ID: <4d505dd3-b289-4191-95f2-4a6eaa647e81@microchip.com> (raw)
In-Reply-To: <c70c100a-ebfd-442e-875f-738593faf0dc@web.de>
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@users.sourceforge.net>
Acked-by: Aubin Constans <aubin.constans@microchip.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
parent reply other threads:[~2023-11-10 20:14 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <c70c100a-ebfd-442e-875f-738593faf0dc@web.de>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d505dd3-b289-4191-95f2-4a6eaa647e81@microchip.com \
--to=aubin.constans@microchip.com \
--cc=Julia.Lawall@inria.fr \
--cc=Markus.Elfring@web.de \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=cocci@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®