[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200921215359.45003-5-alex.dewar90@gmail.com>
Date: Mon, 21 Sep 2020 22:53:57 +0100
From: Alex Dewar <alex.dewar90@...il.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alex Dewar <alex.dewar90@...il.com>,
Linus Walleij <linus.walleij@...aro.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
Alan Cox <alan@...ux.intel.com>, linux-media@...r.kernel.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH RESEND 4/5] 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. Instead, print a warning and
free flash unconditionally.
Signed-off-by: Alex Dewar <alex.dewar90@...il.com>
---
.../staging/media/atomisp/i2c/atomisp-lm3554.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index d78014847e67..d446ee8e93db 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -782,7 +782,7 @@ static int lm3554_gpio_init(struct i2c_client *client)
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 lm3554 *flash = to_lm3554(sd);
@@ -791,13 +791,13 @@ static int lm3554_gpio_uninit(struct i2c_client *client)
ret = gpiod_direction_output(pdata->gpio_strobe, 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);
if (ret < 0)
- return ret;
-
- return 0;
+ dev_err(&client->dev,
+ "gpio request/direction_output fail for gpio_reset");
}
static void *lm3554_platform_data_func(struct i2c_client *client)
@@ -907,7 +907,6 @@ static int lm3554_remove(struct i2c_client *client)
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct lm3554 *flash = to_lm3554(sd);
- int ret;
media_entity_cleanup(&flash->sd.entity);
v4l2_ctrl_handler_free(&flash->ctrl_handler);
@@ -917,16 +916,11 @@ static int lm3554_remove(struct i2c_client *client)
del_timer_sync(&flash->flash_off_delay);
- ret = lm3554_gpio_uninit(client);
- if (ret < 0)
- goto fail;
+ lm3554_gpio_uninit(client);
kfree(flash);
return 0;
-fail:
- dev_err(&client->dev, "gpio request/direction_output fail");
- return ret;
}
static const struct dev_pm_ops lm3554_pm_ops = {
--
2.28.0
Powered by blists - more mailing lists