summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-01-30 09:36:54 +0100
committerHans de Goede <hdegoede@redhat.com>2022-02-03 11:56:04 +0100
commit34fc68348554d5b0f98def6cae9f252c3eb0c172 (patch)
tree1836aae431957c780aa9dcb3d6970dafdd5efaf5 /drivers
parent6768bddb70f028a03cb297f18402988599959f7e (diff)
downloadlinux-34fc68348554d5b0f98def6cae9f252c3eb0c172.tar.bz2
platform/surface: surface3-wmi: Simplify resource management
'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. Fixes: 3dda3b3798f9 ("platform/x86: Add custom surface3 platform device for controlling LID") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/8b1a6d05036d5d9527241b2345482b369331ce5c.1643531799.git.christophe.jaillet@wanadoo.fr Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/surface/surface3-wmi.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/platform/surface/surface3-wmi.c b/drivers/platform/surface/surface3-wmi.c
index 089a8a48d920..ca4602bcc7de 100644
--- a/drivers/platform/surface/surface3-wmi.c
+++ b/drivers/platform/surface/surface3-wmi.c
@@ -186,14 +186,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)