Skip to content

Commit

Permalink
regulator: da9121: Emit only one error message in .remove()
Browse files Browse the repository at this point in the history
When an i2c remove callback fails, the i2c core emits a generic error
message and still removes the device. Apart from the message there the
return value isn't further used.

So don't return an error code after having already emitted a driver
specific warning about the problem to prevent two messages about the
same issue.

Signed-off-by: Uwe Kleine-König <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Uwe Kleine-König authored and broonie committed Nov 16, 2021
1 parent fa55b7d commit 4950486
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/regulator/da9121-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,15 +1065,15 @@ static int da9121_i2c_remove(struct i2c_client *i2c)
{
struct da9121 *chip = i2c_get_clientdata(i2c);
const int mask_all[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
int ret = 0;
int ret;

free_irq(chip->chip_irq, chip);
cancel_delayed_work_sync(&chip->work);

ret = regmap_bulk_write(chip->regmap, DA9121_REG_SYS_MASK_0, mask_all, 4);
if (ret != 0)
dev_err(chip->dev, "Failed to set IRQ masks: %d\n", ret);
return ret;
return 0;
}

static const struct i2c_device_id da9121_i2c_id[] = {
Expand Down

0 comments on commit 4950486

Please sign in to comment.