lkml.org 
[lkml]   [2022]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] surface: surface3-wmi: Simplify resource management
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


\
 
 \ /
  Last update: 2022-01-31 12:52    [W:0.046 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site