Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: stmfx: Improve error message triggered by regulator fault in .remove()

Returning a non-zero value in an i2c remove callback results in the i2c
core emitting a very generic error message ("remove failed (-ESOMETHING),
will be ignored") and as the message indicates not further error handling
is done.

Instead emit a more specific error message and then return zero in
.remove().

The long-term goal is to make the i2c remove prototype return void, making
all implementations return 0 is preparatory work for this change.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220214150710.312269-1-u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Lee Jones
c788f6e6 2a6bacf7

+12 -5
+12 -5
drivers/mfd/stmfx.c
··· 392 392 return ret; 393 393 } 394 394 395 - static int stmfx_chip_exit(struct i2c_client *client) 395 + static void stmfx_chip_exit(struct i2c_client *client) 396 396 { 397 397 struct stmfx *stmfx = i2c_get_clientdata(client); 398 398 399 399 regmap_write(stmfx->map, STMFX_REG_IRQ_SRC_EN, 0); 400 400 regmap_write(stmfx->map, STMFX_REG_SYS_CTRL, 0); 401 401 402 - if (stmfx->vdd) 403 - return regulator_disable(stmfx->vdd); 402 + if (stmfx->vdd) { 403 + int ret; 404 404 405 - return 0; 405 + ret = regulator_disable(stmfx->vdd); 406 + if (ret) 407 + dev_err(&client->dev, 408 + "Failed to disable vdd regulator: %pe\n", 409 + ERR_PTR(ret)); 410 + } 406 411 } 407 412 408 413 static int stmfx_probe(struct i2c_client *client, ··· 471 466 { 472 467 stmfx_irq_exit(client); 473 468 474 - return stmfx_chip_exit(client); 469 + stmfx_chip_exit(client); 470 + 471 + return 0; 475 472 } 476 473 477 474 #ifdef CONFIG_PM_SLEEP