All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] eeprom: at24: check the return value of nvmem_unregister()
@ 2017-12-27 14:10 Bartosz Golaszewski
  2017-12-28 11:28 ` Johan Hovold
  0 siblings, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2017-12-27 14:10 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-kernel, Bartosz Golaszewski

This function can fail with -EBUSY, but we don't check its return
value in at24_remove(). Bail-out of remove() if nvmem_unregister()
doesn't succeed.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
 drivers/misc/eeprom/at24.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index e79833d62284..fb21e1c45115 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -684,11 +684,13 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 static int at24_remove(struct i2c_client *client)
 {
 	struct at24_data *at24;
-	int i;
+	int i, ret;
 
 	at24 = i2c_get_clientdata(client);
 
-	nvmem_unregister(at24->nvmem);
+	ret = nvmem_unregister(at24->nvmem);
+	if (ret)
+		return ret;
 
 	for (i = 1; i < at24->num_addresses; i++)
 		i2c_unregister_device(at24->client[i].client);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-02 11:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-27 14:10 [PATCH] eeprom: at24: check the return value of nvmem_unregister() Bartosz Golaszewski
2017-12-28 11:28 ` Johan Hovold
2017-12-28 21:42   ` Bartosz Golaszewski
2017-12-28 23:05     ` Heiner Kallweit
2017-12-29  9:48     ` Johan Hovold
2018-01-02 11:17     ` Srinivas Kandagatla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.