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

From: Hans de Goede
Date: Tue Jun 13 2023 - 11:37:27 EST


Hi,

On 6/13/23 17:12, 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?
>
>> 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?

Done and pushed to review-hans.

Regards,

Hans