linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: media: atomisp: Don't abort on error in module exit path
@ 2020-09-03 18:31 Alex Dewar
  2020-09-03 18:31 ` [PATCH 2/2] staging: media: atomisp: Remove unhelpful info message Alex Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Dewar @ 2020-09-03 18:31 UTC (permalink / raw)
  Cc: Alex Dewar, Mauro Carvalho Chehab, Sakari Ailus,
	Greg Kroah-Hartman, Linus Walleij, linux-media, devel,
	linux-kernel

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.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 .../staging/media/atomisp/i2c/atomisp-lm3554.c  | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index cca10a4c2db0..621555b0cf6b 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -783,7 +783,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);
@@ -792,13 +792,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)
@@ -918,16 +918,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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] staging: media: atomisp: Remove unhelpful info message
  2020-09-03 18:31 [PATCH 1/2] staging: media: atomisp: Don't abort on error in module exit path Alex Dewar
@ 2020-09-03 18:31 ` Alex Dewar
  2020-09-19 19:32   ` Alex Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Dewar @ 2020-09-03 18:31 UTC (permalink / raw)
  Cc: Alex Dewar, Mauro Carvalho Chehab, Sakari Ailus,
	Greg Kroah-Hartman, Linus Walleij, linux-media, devel,
	linux-kernel

We don't really need to know that the LED pin reset successfully.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/staging/media/atomisp/i2c/atomisp-lm3554.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index 621555b0cf6b..77b7f59e62d7 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -771,7 +771,6 @@ static int lm3554_gpio_init(struct i2c_client *client)
 	ret = gpiod_direction_output(pdata->gpio_reset, 0);
 	if (ret < 0)
 		return ret;
-	dev_info(&client->dev, "flash led reset successfully\n");
 
 	if (!pdata->gpio_strobe)
 		return -EINVAL;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] staging: media: atomisp: Remove unhelpful info message
  2020-09-03 18:31 ` [PATCH 2/2] staging: media: atomisp: Remove unhelpful info message Alex Dewar
@ 2020-09-19 19:32   ` Alex Dewar
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Dewar @ 2020-09-19 19:32 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
	Linus Walleij, linux-media, devel, linux-kernel

On 2020-09-03 19:31, Alex Dewar wrote:
> We don't really need to know that the LED pin reset successfully.
Ping?
>
> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> ---
>   drivers/staging/media/atomisp/i2c/atomisp-lm3554.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
> index 621555b0cf6b..77b7f59e62d7 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
> @@ -771,7 +771,6 @@ static int lm3554_gpio_init(struct i2c_client *client)
>   	ret = gpiod_direction_output(pdata->gpio_reset, 0);
>   	if (ret < 0)
>   		return ret;
> -	dev_info(&client->dev, "flash led reset successfully\n");
>   
>   	if (!pdata->gpio_strobe)
>   		return -EINVAL;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-19 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 18:31 [PATCH 1/2] staging: media: atomisp: Don't abort on error in module exit path Alex Dewar
2020-09-03 18:31 ` [PATCH 2/2] staging: media: atomisp: Remove unhelpful info message Alex Dewar
2020-09-19 19:32   ` Alex Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).