mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "linyujun (C)" <linyujun809@huawei.com>
To: <daniel@zonque.org>, <haojian.zhuang@gmail.com>,
	<robert.jarzmik@free.fr>, <linux@armlinux.org.uk>,
	<eric.miao@marvell.com>, <krzysztof.h1@wp.pl>,
	<jayakumar.lkml@gmail.com>
Cc: <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] [ARM] am200epd: Release platform device in case of platform_device_add_data() fails
Date: Mon, 26 Sep 2022 17:15:35 +0800	[thread overview]
Message-ID: <978a3b27-24dc-e015-cd04-4b2be16b825c@huawei.com> (raw)
In-Reply-To: <20220914033621.99499-1-linyujun809@huawei.com>

kindly ping

在 2022/9/14 11:36, Lin Yujun 写道:
> The platform resources need to be released when platform_device_add_data()
> fails. Release the platform device and unregister the client notifier like
> the error handling of platform_device_add().
>
> Fixes: 922613436ae5 ("[ARM] 5200/1: am200epd: use fb notifiers and gpio api")
> Signed-off-by: Lin Yujun <linyujun809@huawei.com>
> ---
>   arch/arm/mach-pxa/am200epd.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
> index cac0bb09db14..069b90df0759 100644
> --- a/arch/arm/mach-pxa/am200epd.c
> +++ b/arch/arm/mach-pxa/am200epd.c
> @@ -370,12 +370,16 @@ int __init am200_init(void)
>   		return -ENOMEM;
>   
>   	/* the am200_board that will be seen by metronomefb is a copy */
> -	platform_device_add_data(am200_device, &am200_board,
> +	ret = platform_device_add_data(am200_device, &am200_board,
>   					sizeof(am200_board));
> +	if (ret) {
> +		platform_device_put(am200_device);
> +		fb_unregister_client(&am200_fb_notif);
> +		return ret;
> +	}
>   
>   	/* this _add binds metronomefb to am200. metronomefb refcounts am200 */
>   	ret = platform_device_add(am200_device);
> -
>   	if (ret) {
>   		platform_device_put(am200_device);
>   		fb_unregister_client(&am200_fb_notif);

      reply	other threads:[~2022-09-26  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  3:36 Lin Yujun
2022-09-26  9:15 ` linyujun (C) [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=978a3b27-24dc-e015-cd04-4b2be16b825c@huawei.com \
    --to=linyujun809@huawei.com \
    --cc=daniel@zonque.org \
    --cc=eric.miao@marvell.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=jayakumar.lkml@gmail.com \
    --cc=krzysztof.h1@wp.pl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=robert.jarzmik@free.fr \
    /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®