A driver remove callback is only called if the device was bound before. So it's sure that both dev and dev->driver are valid and dev is an i2c device. If the check fails something louder than "return 0" might be appropriate because the problem is grave (something like memory corruption), otherwise the check is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> --- drivers/i2c/i2c-core-base.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 86e43016ff85..be995a95c4ac 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -549,12 +549,9 @@ static int i2c_device_probe(struct device *dev) static int i2c_device_remove(struct device *dev) { - struct i2c_client *client = i2c_verify_client(dev); + struct i2c_client *client = to_i2c_client(dev); struct i2c_driver *driver; - if (!client || !dev->driver) - return 0; - driver = to_i2c_driver(dev->driver); if (driver->remove) { int status = 0; -- 2.29.2