From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Hans de Goede <hdegoede@redhat.com>,
Mark Gross <markgross@kernel.org>,
Maximilian Luz <luzmaximilian@gmail.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] surface: surface3-wmi: Simplify resource management
Date: Mon, 31 Jan 2022 13:24:24 +0200 [thread overview]
Message-ID: <YffG6JKmGCS1/h08@smile.fi.intel.com> (raw)
In-Reply-To: <8b1a6d05036d5d9527241b2345482b369331ce5c.1643531799.git.christophe.jaillet@wanadoo.fr>
On Sun, Jan 30, 2022 at 09:36:54AM +0100, Christophe JAILLET wrote:
> 's3_wmi.input' is a managed resource, so there should be no need to free it
> explicitly.
>
> Moreover, 's3_wmi' is a global variable. 's3_wmi.input' should be NULL
> when this error handling path is executed, because it has not been
> assigned yet.
>
> All this is puzzling. So simplify it and remove a few lines of code to have
> it be more straightforward.
Seems correct cleanup / fix to me
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Fixes: 3dda3b3798f9 ("platform/x86: Add custom surface3 platform device for controlling LID")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
> drivers/platform/surface/surface3-wmi.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/platform/surface/surface3-wmi.c b/drivers/platform/surface/surface3-wmi.c
> index 09ac9cfc40d8..b9a4b2d81f4b 100644
> --- a/drivers/platform/surface/surface3-wmi.c
> +++ b/drivers/platform/surface/surface3-wmi.c
> @@ -190,14 +190,11 @@ static int s3_wmi_create_and_register_input(struct platform_device *pdev)
>
> error = input_register_device(input);
> if (error)
> - goto out_err;
> + return error;
>
> s3_wmi.input = input;
>
> return 0;
> - out_err:
> - input_free_device(s3_wmi.input);
> - return error;
> }
>
> static int __init s3_wmi_probe(struct platform_device *pdev)
> --
> 2.32.0
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-01-31 11:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-30 8:36 [PATCH] surface: surface3-wmi: Simplify resource management Christophe JAILLET
2022-01-31 11:24 ` Andy Shevchenko [this message]
2022-01-31 12:50 ` Maximilian Luz
2022-02-03 10:44 ` Hans de Goede
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=YffG6JKmGCS1/h08@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=hdegoede@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.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