mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-14 21:29:37 +02:00
leds: an30259a: Use devm_mutex_init() for mutex initialization
[ Upstream commit c382e2e3ec
]
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 mutex which was destroyed already
in module's remove() so use devm API instead.
Signed-off-by: George Stark <gnstark@salutedevices.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240411161032.609544-9-gnstark@salutedevices.com
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7d2a6abec0
commit
3ead19aa34
|
@ -283,7 +283,10 @@ static int an30259a_probe(struct i2c_client *client)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
mutex_init(&chip->mutex);
|
err = devm_mutex_init(&client->dev, &chip->mutex);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
chip->client = client;
|
chip->client = client;
|
||||||
i2c_set_clientdata(client, chip);
|
i2c_set_clientdata(client, chip);
|
||||||
|
|
||||||
|
@ -317,17 +320,9 @@ static int an30259a_probe(struct i2c_client *client)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mutex_destroy(&chip->mutex);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void an30259a_remove(struct i2c_client *client)
|
|
||||||
{
|
|
||||||
struct an30259a *chip = i2c_get_clientdata(client);
|
|
||||||
|
|
||||||
mutex_destroy(&chip->mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct of_device_id an30259a_match_table[] = {
|
static const struct of_device_id an30259a_match_table[] = {
|
||||||
{ .compatible = "panasonic,an30259a", },
|
{ .compatible = "panasonic,an30259a", },
|
||||||
{ /* sentinel */ },
|
{ /* sentinel */ },
|
||||||
|
@ -347,7 +342,6 @@ static struct i2c_driver an30259a_driver = {
|
||||||
.of_match_table = an30259a_match_table,
|
.of_match_table = an30259a_match_table,
|
||||||
},
|
},
|
||||||
.probe = an30259a_probe,
|
.probe = an30259a_probe,
|
||||||
.remove = an30259a_remove,
|
|
||||||
.id_table = an30259a_id,
|
.id_table = an30259a_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user