linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Dewar <alex.dewar90@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alex Dewar <alex.dewar90@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Alan Cox <alan@linux.intel.com>,
	linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH REBASE 3/3] staging: media: atomisp: Don't abort on error in module exit path
Date: Tue, 22 Sep 2020 10:09:10 +0100	[thread overview]
Message-ID: <20200922090914.20702-4-alex.dewar90@gmail.com> (raw)
In-Reply-To: <20200922090914.20702-1-alex.dewar90@gmail.com>

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@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 5e895586e80a..84c47c1f9eb4 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -794,7 +794,7 @@ static int lm3554_gpio_init(struct i2c_client *client)
 	return ret;
 }
 
-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);
@@ -803,15 +803,16 @@ static int lm3554_gpio_uninit(struct i2c_client *client)
 
 	ret = gpio_direction_output(pdata->gpio_strobe, 0);
 	if (ret < 0)
-		return ret;
+		dev_err(&client->dev,
+			"gpio request/direction_output fail for gpio_strobe");
 
 	ret = gpio_direction_output(pdata->gpio_reset, 0);
 	if (ret < 0)
-		return ret;
+		dev_err(&client->dev,
+			"gpio request/direction_output fail for gpio_reset");
 
 	gpio_free(pdata->gpio_strobe);
 	gpio_free(pdata->gpio_reset);
-	return 0;
 }
 
 static void *lm3554_platform_data_func(struct i2c_client *client)
@@ -918,7 +919,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);
@@ -928,16 +928,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


  parent reply	other threads:[~2020-09-22  9:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 21:53 [PATCH RESEND 0/5] atomisp: Fixes and cleanups Alex Dewar
2020-09-21 21:53 ` [PATCH RESEND 1/5] staging: media: atomisp: Fix error path in lm3554_probe() Alex Dewar
2020-09-21 21:53 ` [PATCH RESEND 2/5] staging: media: atomisp: Remove unhelpful info message Alex Dewar
2020-09-21 21:53 ` [PATCH RESEND 3/5] staging: media: atomisp: Don't do unnecessary zeroing of memory Alex Dewar
2020-09-21 21:53 ` [PATCH RESEND 4/5] staging: media: atomisp: Don't abort on error in module exit path Alex Dewar
2020-09-21 21:53 ` [PATCH RESEND 5/5] staging: media: atomisp: Fix bool-related style issues Alex Dewar
2020-09-22  8:11 ` [PATCH RESEND 0/5] atomisp: Fixes and cleanups Mauro Carvalho Chehab
2020-09-22  8:16   ` Alex Dewar
2020-09-22  9:09     ` [PATCH REBASE 0/3] atomisp: Rebased fixes Alex Dewar
2020-09-22  9:09       ` [PATCH REBASE 1/3] staging: media: atomisp: Fix error path in lm3554_probe() Alex Dewar
2020-09-22  9:09       ` [PATCH REBASE 2/3] staging: media: atomisp: Remove unhelpful info message Alex Dewar
2020-09-22  9:09       ` Alex Dewar [this message]
2020-09-22  9:27       ` [PATCH REBASE 0/3] atomisp: Rebased fixes Mauro Carvalho Chehab
2020-09-22 11:02         ` Alex Dewar
2020-09-22 13:27           ` Dan Carpenter
2020-09-22 13:51             ` Alex Dewar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922090914.20702-4-alex.dewar90@gmail.com \
    --to=alex.dewar90@gmail.com \
    --cc=alan@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).