All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Borislav Petkov <bp@suse.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/firmware: Add missing platform_device_put() in sysfb_create_simplefb
Date: Thu, 13 Jan 2022 12:16:55 +0100	[thread overview]
Message-ID: <735d2b47-227f-f09d-ddd6-28bc82a066a5@redhat.com> (raw)
In-Reply-To: <20211231080431.15385-1-linmq006@gmail.com>

Hello Miaoqian,

On 12/31/21 09:04, Miaoqian Lin wrote:
> Add the missing platform_device_put() before return from
> sysfb_create_simplefb() in the error handling case.
> 
> Fixes: 8633ef8 ("drivers/firmware: consolidate EFI framebuffer setup for all arches")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---

Thanks for the patch.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

>  drivers/firmware/sysfb_simplefb.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c
> index b86761904949..303a491e520d 100644
> --- a/drivers/firmware/sysfb_simplefb.c
> +++ b/drivers/firmware/sysfb_simplefb.c
> @@ -113,12 +113,16 @@ __init int sysfb_create_simplefb(const struct screen_info *si,
>  	sysfb_apply_efi_quirks(pd);
>  
>  	ret = platform_device_add_resources(pd, &res, 1);
> -	if (ret)
> +	if (ret) {
> +		platform_device_put(pd);
>  		return ret;
> +	}
>  
>  	ret = platform_device_add_data(pd, mode, sizeof(*mode));
> -	if (ret)
> +	if (ret) {
> +		platform_device_put(pd);
>  		return ret;
> +	}
>

To avoid duplicating the error code logic twice, you could also do:

	if (ret)
		goto pdev_put;
  
>  	return platform_device_add(pd);

and then after this return statement:

pdev_put:
	platform_device_put(pd);
	return ret;

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat


  reply	other threads:[~2022-01-13 11:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31  8:04 [PATCH] drivers/firmware: Add missing platform_device_put() in sysfb_create_simplefb Miaoqian Lin
2022-01-13 11:16 ` Javier Martinez Canillas [this message]
2022-01-16 12:16   ` [PATCH v2] " Miaoqian Lin
2022-01-16 17:31     ` Javier Martinez Canillas
2022-02-04 15:41       ` Greg KH

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=735d2b47-227f-f09d-ddd6-28bc82a066a5@redhat.com \
    --to=javierm@redhat.com \
    --cc=bp@suse.de \
    --cc=daniel.vetter@ffwll.ch \
    --cc=gregkh@linuxfoundation.org \
    --cc=linmq006@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.