mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Markus Elfring <Markus.Elfring@web.de>,
	linux-ide@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ata: libahci_platform: Use common error handling code in ahci_platform_get_resources()
Date: Mon, 23 Sep 2019 11:07:38 +0200	[thread overview]
Message-ID: <7463a1d5-e76f-99a6-5a1e-f9477da3c1da@redhat.com> (raw)
In-Reply-To: <6ca97aeb-0892-ed0e-a149-b25848adf324@web.de>

Hi,

On 22-09-2019 15:55, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 22 Sep 2019 15:42:46 +0200
> 
> Convert the call of the function “of_node_put” to another jump target
> so that it can be better reused at three places in this function.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>   drivers/ata/libahci_platform.c | 17 +++++++----------
>   1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index e742780950de..7b2e364f3bd5 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -497,8 +497,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
> 
>   			if (of_property_read_u32(child, "reg", &port)) {
>   				rc = -EINVAL;
> -				of_node_put(child);
> -				goto err_out;
> +				goto err_put_node;
>   			}
> 
>   			if (port >= hpriv->nports) {
> @@ -515,18 +514,14 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
>   			if (port_dev) {
>   				rc = ahci_platform_get_regulator(hpriv, port,
>   								&port_dev->dev);
> -				if (rc == -EPROBE_DEFER) {
> -					of_node_put(child);
> -					goto err_out;
> -				}
> +				if (rc == -EPROBE_DEFER)
> +					goto err_put_node;
>   			}
>   #endif
> 
>   			rc = ahci_platform_get_phy(hpriv, port, dev, child);
> -			if (rc) {
> -				of_node_put(child);
> -				goto err_out;
> -			}
> +			if (rc)
> +				goto err_put_node;
> 
>   			enabled_ports++;
>   		}
> @@ -558,6 +553,8 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev,
>   	devres_remove_group(dev, NULL);
>   	return hpriv;
> 
> +err_put_node:
> +	of_node_put(child);
>   err_out:
>   	devres_release_group(dev, NULL);
>   	return ERR_PTR(rc);
> --
> 2.23.0
> 


      reply	other threads:[~2019-09-23  9:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-22 13:55 Markus Elfring
2019-09-23  9:07 ` Hans de Goede [this message]

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=7463a1d5-e76f-99a6-5a1e-f9477da3c1da@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=Markus.Elfring@web.de \
    --cc=axboe@kernel.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nishkadg.linux@gmail.com \
    /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®