Commit f07d34d1 authored by Alex Dewar's avatar Alex Dewar Committed by Mauro Carvalho Chehab

media: staging: media: atomisp: Don't abort on error in module exit path

The function lm3554_remove() checks for the return code for
lm3554_gpio_uninit() even though this is on the exit path and exits the
function, leaving the variable flash unfreed. Print a warning instead
and free flash unconditionally.

Link: https://lore.kernel.org/linux-media/20200903183145.720727-1-alex.dewar90@gmail.comSigned-off-by: default avatarAlex Dewar <alex.dewar90@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent d4a3fa66
...@@ -783,7 +783,7 @@ static int lm3554_gpio_init(struct i2c_client *client) ...@@ -783,7 +783,7 @@ static int lm3554_gpio_init(struct i2c_client *client)
return 0; return 0;
} }
static int lm3554_gpio_uninit(struct i2c_client *client) static void lm3554_gpio_uninit(struct i2c_client *client)
{ {
struct v4l2_subdev *sd = i2c_get_clientdata(client); struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct lm3554 *flash = to_lm3554(sd); struct lm3554 *flash = to_lm3554(sd);
...@@ -792,13 +792,13 @@ static int lm3554_gpio_uninit(struct i2c_client *client) ...@@ -792,13 +792,13 @@ static int lm3554_gpio_uninit(struct i2c_client *client)
ret = gpiod_direction_output(pdata->gpio_strobe, 0); ret = gpiod_direction_output(pdata->gpio_strobe, 0);
if (ret < 0) if (ret < 0)
return ret; dev_err(&client->dev,
"gpio request/direction_output fail for gpio_strobe");
ret = gpiod_direction_output(pdata->gpio_reset, 0); ret = gpiod_direction_output(pdata->gpio_reset, 0);
if (ret < 0) if (ret < 0)
return ret; dev_err(&client->dev,
"gpio request/direction_output fail for gpio_reset");
return 0;
} }
static void *lm3554_platform_data_func(struct i2c_client *client) static void *lm3554_platform_data_func(struct i2c_client *client)
...@@ -914,16 +914,11 @@ static int lm3554_remove(struct i2c_client *client) ...@@ -914,16 +914,11 @@ static int lm3554_remove(struct i2c_client *client)
del_timer_sync(&flash->flash_off_delay); del_timer_sync(&flash->flash_off_delay);
ret = lm3554_gpio_uninit(client); lm3554_gpio_uninit(client);
if (ret < 0)
goto fail;
kfree(flash); kfree(flash);
return 0; return 0;
fail:
dev_err(&client->dev, "gpio request/direction_output fail");
return ret;
} }
static const struct dev_pm_ops lm3554_pm_ops = { static const struct dev_pm_ops lm3554_pm_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment