Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp904779imm; Fri, 11 May 2018 08:07:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpxcgULCYD4rqRnpdlYop1ZKGpm6u1FxUKPe8CfqEVQ0vWPImhN4G+jcOQd1hJHLMb0cGrR X-Received: by 2002:a17:902:7b97:: with SMTP id w23-v6mr5973635pll.116.1526051266326; Fri, 11 May 2018 08:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526051266; cv=none; d=google.com; s=arc-20160816; b=A/QjO7NGvs8WqXd9kKuOir33rA2jE42X/lONB6a/ZGJPqVHSd1wnpKRk3X+9cCHQlm mdz4J86mgbx/xt+BSnopPwS7buTHUjuaaJsd8sx/HFkJzguOaJVTaTte13L2ELmnuMsx gWRJkI5fNYWORkgb2Mai7Rql1v2gzLUenk4efSiDC/bT+YzGbwkVIigGa6T0FwXiEqUC 6ACZlrebaceNkl6YFq4riNyqPfDm43nHRsEjdaQWV3NTtwQ6nSDqMQ/FUUVUiggdU5ug br2rMrSvGYSA6CL/YhxLzkEn+G5CeWPPqx+2jTiVzKVrEGWwm6z3e8+pnTpVAC+R7Xw+ Babg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qdBPM30weM4Loa2ZwH8+vOfyeY+qpXX4pjCuOi7jo5I=; b=ldVsxBwUGQ0epgB04nCyzRvDMdmDkuUcO+9ZTbqr2uL0dESTpXvTCY709ySIkR2Wfj spw7kZjrHr948uBW3xfl8xEnrX6Y8IIEEAmnyAQxeN5OWyDqOPRd7lqP61s8cxxwQA/y V7RY/1pEtrvysoCOqvyjcctJaOfH4tzKhkYWGwocGFXotvDfAN+yBoL9e9063/yaiCDY fiARFeID19pEkOBU2+vjthoBWZ9SnFqdoMQSkQBJV8X6QiTdASjxj1WaR1z+Frzv67cp 06Vwa+u/ID2ndVFlo3aZBi/Als6LMptHsdZDbgz1vvPoAhy25J/Fdh8RBTUDXAQ18EvV /uIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10-v6si3523747pla.260.2018.05.11.08.07.32; Fri, 11 May 2018 08:07:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753521AbeEKPGk (ORCPT + 99 others); Fri, 11 May 2018 11:06:40 -0400 Received: from smtp01.smtpout.orange.fr ([80.12.242.123]:16647 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753293AbeEKPGh (ORCPT ); Fri, 11 May 2018 11:06:37 -0400 Received: from ubuntu-CJ.home ([86.244.116.1]) by mwinf5d36 with ME id l36B1x00C01t9Ri0336cb9; Fri, 11 May 2018 17:06:36 +0200 X-ME-Helo: ubuntu-CJ.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 11 May 2018 17:06:36 +0200 X-ME-IP: 86.244.116.1 From: Christophe JAILLET 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: linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET 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 Message-Id: <2eff9a8d6d67b60aed87277ab4f8b48b2251d559.1526048313.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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