LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: alan@linux.intel.com, sakari.ailus@linux.intel.com,
mchehab@kernel.org, gregkh@linuxfoundation.org,
andriy.shevchenko@linux.intel.com, chen.chenchacha@foxmail.com,
keescook@chromium.org, arvind.yadav.cs@gmail.com
Cc: devel@driverdev.osuosl.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org
Subject: [PATCH 1/3] media: staging: atomisp: Return an error code in case of error in 'lm3554_probe()'
Date: Fri, 11 May 2018 17:06:16 +0200 [thread overview]
Message-ID: <2eff9a8d6d67b60aed87277ab4f8b48b2251d559.1526048313.git.christophe.jaillet@wanadoo.fr> (raw)
In-Reply-To: <cover.1526048313.git.christophe.jaillet@wanadoo.fr>
In-Reply-To: <cover.1526048313.git.christophe.jaillet@wanadoo.fr>
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(-)
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
index 7098bf317f16..723fa74ff815 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c
@@ -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;
}
--
2.17.0
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2018-05-11 15:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 15:06 [PATCH 0/3] media: staging: atomisp: Christophe JAILLET
2018-05-11 15:06 ` Christophe JAILLET [this message]
2018-05-11 15:06 ` [PATCH 2/3] media: staging: atomisp: Fix an error handling path in 'lm3554_probe()' Christophe JAILLET
2018-05-11 15:09 ` Julia Lawall
2018-05-11 15:31 ` Alan Cox
2018-05-11 15:06 ` [PATCH 3/3] media: staging: atomisp: Fix usage of 'media_entity_cleanup()' Christophe JAILLET
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=2eff9a8d6d67b60aed87277ab4f8b48b2251d559.1526048313.git.christophe.jaillet@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=alan@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arvind.yadav.cs@gmail.com \
--cc=chen.chenchacha@foxmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--subject='Re: [PATCH 1/3] media: staging: atomisp: Return an error code in case of error in '\''lm3554_probe()'\''' \
/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
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).