@@ -844,7 +844,7 @@ static int mt9p031_registered(struct v4l2_subdev *subdev)
ret = mt9p031_power_on(mt9p031);
if (ret < 0) {
dev_err(&client->dev, "MT9P031 power up failed\n");
- return ret;
+ goto done;
}
/* Read out the chip version register */
@@ -852,13 +852,15 @@ static int mt9p031_registered(struct v4l2_subdev *subdev)
if (data != MT9P031_CHIP_VERSION_VALUE) {
dev_err(&client->dev, "MT9P031 not detected, wrong version "
"0x%04x\n", data);
- return -ENODEV;
+ ret = -ENODEV;
}
+done:
mt9p031_power_off(mt9p031);
- dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n",
- client->addr);
+ if (!ret)
+ dev_info(&client->dev, "MT9P031 detected at address 0x%02x\n",
+ client->addr);
return ret;
}
The mt9p031 driver first accesses the I2C device in its .registered() method. While doing that it furst powers the device up, but if probing fails, it doesn't power the chip back down. This patch fixes that bug. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> --- drivers/media/i2c/mt9p031.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)