Skip to contentSkip to conversation

i2c: make i2c_unregister_device() ERR_PTR safe

PATCH Applied Wolfram Sang 3 participants 3 messages Aug 19, 2019 – Aug 29, 2019 I2C

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: make i2c_unregister_device() ERR_PTR safe

We are moving towards returning ERR_PTRs when i2c_new_*_device() calls fail. Make sure its counterpart for unregistering handles ERR_PTRs as well.

---
 drivers/i2c/i2c-core-base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +1 -1
index 76cb91e064b8..e5ba612ddc1e 100644
@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
  */
 void i2c_unregister_device(struct i2c_client *client)
 {
-	if (!client)
+	if (IS_ERR_OR_NULL(client))
 		return;
 
 	if (client->dev.of_node) {
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Wolfram Sang

We are moving towards returning ERR_PTRs when i2c_new_*_device() calls fail. Make sure its counterpart for unregistering handles ERR_PTRs as well.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds