@@ -852,10 +852,9 @@ static void *lm3554_platform_data_func(struct i2c_client *client)
static int lm3554_probe(struct i2c_client *client)
{
- int err = 0;
+ int err;
struct lm3554 *flash;
unsigned int i;
- int ret;
flash = kzalloc(sizeof(*flash), GFP_KERNEL);
if (!flash)
@@ -868,10 +867,9 @@ static int lm3554_probe(struct i2c_client *client)
flash->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
flash->mode = ATOMISP_FLASH_MODE_OFF;
flash->timeout = LM3554_MAX_TIMEOUT / LM3554_TIMEOUT_STEPSIZE - 1;
- ret =
- v4l2_ctrl_handler_init(&flash->ctrl_handler,
- ARRAY_SIZE(lm3554_controls));
- if (ret) {
+ err = v4l2_ctrl_handler_init(&flash->ctrl_handler,
+ ARRAY_SIZE(lm3554_controls));
+ if (err) {
dev_err(&client->dev, "error initialize a ctrl_handler.\n");
goto fail2;
}
If 'v4l2_ctrl_handler_init()' fails, we go to the error handling path, do some clean-up and return err, which is known to be 0 (i.e. success). Axe the 'ret' variable and use 'err' directly in order to return the error code instead. Also remove the initialization of 'err' which was hiding this issue. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> --- drivers/staging/media/atomisp/i2c/atomisp-lm3554.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)