i2c: make i2c_unregister_device() ERR_PTR safe
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.
Signed-off-by Wolfram Sang <[email protected]>
--- drivers/i2c/i2c-core-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core-base.c +1 -1
@@ -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
Quoted 5 lines · Wolfram Sang
We are moving towards returning
ERR_PTRswhen i2c_new_*_device() calls fail. Make sure its counterpart for unregistering handlesERR_PTRsas well.Signed-off-by Wolfram Sang <[email protected]>
Reviewed-by Geert Uytterhoeven <[email protected]>
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
Wolfram Sang
AppliedQuoted 5 lines · Wolfram Sang
We are moving towards returning
ERR_PTRswhen i2c_new_*_device() calls fail. Make sure its counterpart for unregistering handlesERR_PTRsas well.Signed-off-by Wolfram Sang <[email protected]>
Applied to for-current, thanks!