Skip to content

Commit 4e970a0

Browse files
Uwe Kleine-Königwsakernel
authored andcommitted
i2c: remove check that can never be true
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@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 71637c6 commit 4e970a0

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,9 @@ static int i2c_device_probe(struct device *dev)
549549

550550
static int i2c_device_remove(struct device *dev)
551551
{
552-
struct i2c_client *client = i2c_verify_client(dev);
552+
struct i2c_client *client = to_i2c_client(dev);
553553
struct i2c_driver *driver;
554554

555-
if (!client || !dev->driver)
556-
return 0;
557-
558555
driver = to_i2c_driver(dev->driver);
559556
if (driver->remove) {
560557
int status;

0 commit comments

Comments
 (0)