[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeQ86JnDF=nJ_AK5zTPB7BkOvn9wU+GottY_PV7JHzGTg@mail.gmail.com>
Date: Mon, 4 Dec 2023 20:15:21 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: George Stark <gnstark@...utedevices.com>
Cc: pavel@....cz, lee@...nel.org, vadimp@...dia.com,
mpe@...erman.id.au, npiggin@...il.com, christophe.leroy@...roup.eu,
hdegoede@...hat.com, mazziesaccount@...il.com, jic23@...nel.org,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, kernel@...utedevices.com
Subject: Re: [PATCH v2 03/10] leds: aw2013: use devm API to cleanup module's resources
On Mon, Dec 4, 2023 at 8:07 PM George Stark <gnstark@...utedevices.com> wrote:
>
> In this driver LEDs are registered using devm_led_classdev_register()
> so they are automatically unregistered after module's remove() is done.
> led_classdev_unregister() calls module's led_set_brightness() to turn off
> the LEDs and that callback uses resources which were destroyed already
> in module's remove() so use devm API instead of remove().
...
> +static void aw2013_chip_disable_action(void *data)
> +{
> + struct aw2013 *chip = (struct aw2013 *)data;
> +
> + aw2013_chip_disable(chip);
> +}
As with mutex release, this also can be oneliner
static void aw2013_chip_disable_action(void *chip)
{
aw2013_chip_disable(chip);
}
...
> + if (devm_mutex_init(&client->dev, &chip->mutex))
> + return -ENOMEM;
Shouldn be
ret = devm_mutex_init(&client->dev, &chip->mutex);
if (ret)
return ret;
?
> + return -ENOMEM;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists