Re: [PATCH v2] platform/x86/dell/dell-rbtn: Fix resources leaking on error path

From: Wilczynski, Michal
Date: Tue Jun 13 2023 - 11:21:37 EST




On 6/13/2023 5:12 PM, Andy Shevchenko wrote:
> On Tue, Jun 13, 2023 at 11:43:10AM +0300, Michal Wilczynski wrote:
>> Currently rbtn_add() in case of failure is leaking resources. Fix this
>> by adding a proper rollback. Move devm_kzalloc() before rbtn_acquire(),
>> so it doesn't require rollback in case of failure. While at it, remove
>> unnecessary assignment of NULL to device->driver_data and unnecessary
>> whitespace, plus add a break for the default case in a switch.
>> Suggested-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
> Isn't also suggested by Pali?

Oh yeah, should have added a tag for Pali as well

>
>> Fixes: 817a5cdb40c8 ("dell-rbtn: Dell Airplane Mode Switch driver")
>> Signed-off-by: Michal Wilczynski <michal.wilczynski@xxxxxxxxx>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>> Acked-by: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> ...
>
> Hans, can it (an additional tag) be folded into applied change?
>