Skip to content

Commit a82c7cf

Browse files
andy-shevlag-linaro
authored andcommitted
leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()
Clang complains that devm_add_action() takes a parameter with a wrong type: warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict] err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. It appears that the commit e1af5c8 ("leds: is31fl319x: Fix devm vs. non-devm ordering") missed two things: - whilst the commit mentions devm_add_action_or_reset() the actual change utilised devm_add_action() call by mistake - strictly speaking the parameter is not compatible by type Fix both issues by switching to devm_add_action_or_reset() and adding a wrapper for mutex_destroy() call. Reported-by: kernel test robot <lkp@intel.com> Fixes: e1af5c8 ("leds: is31fl319x: Fix devm vs. non-devm ordering") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20221228093238.82713-1-andriy.shevchenko@linux.intel.com
1 parent 4934630 commit a82c7cf

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/leds/leds-is31fl319x.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,11 @@ static inline int is31fl3196_db_to_gain(u32 dezibel)
495495
return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP;
496496
}
497497

498+
static void is31f1319x_mutex_destroy(void *lock)
499+
{
500+
mutex_destroy(lock);
501+
}
502+
498503
static int is31fl319x_probe(struct i2c_client *client)
499504
{
500505
struct is31fl319x_chip *is31;
@@ -511,7 +516,7 @@ static int is31fl319x_probe(struct i2c_client *client)
511516
return -ENOMEM;
512517

513518
mutex_init(&is31->lock);
514-
err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock);
519+
err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock);
515520
if (err)
516521
return err;
517522

0 commit comments

Comments
 (0)