From patchwork Sat Oct 17 14:09:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Dewar X-Patchwork-Id: 11842767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BDAF714B4 for ; Sat, 17 Oct 2020 14:17:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D49320714 for ; Sat, 17 Oct 2020 14:17:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eTwx8zBd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437495AbgJQORO (ORCPT ); Sat, 17 Oct 2020 10:17:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392571AbgJQORN (ORCPT ); Sat, 17 Oct 2020 10:17:13 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B222C061755; Sat, 17 Oct 2020 07:17:13 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id y12so6608937wrp.6; Sat, 17 Oct 2020 07:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NKKahgVQmXfUfXn2BJolmwRQuha3ZmdJxDzKc1VCVmQ=; b=eTwx8zBdr7F71FpfenryEIdDs0d5iD9bUkKMoScyMIk6nqwS3cN4aLh3wpDG8C00hB k7q+Y2fmW7phsC9Rv1jkftePn1sFn1PCk6iqSRMa5Uvvk2f7GSJOqUXa953Veb7Gj5sg adxRgyf1JHgC8ISaaBkmmxwMhFn4GBom5k8FDe+lsgBfTyaPj/KX5+YVt5OWFtAKXm7+ mwo/40UH4W2c2jQL2FHz9yHXSb1DK8SZW1n+9fr/GsMaug+OEp9JGrzfLzjXOOLXgPtG 3J1fz0V5K3bkVv7cOfnqwrptsHjAgswxBYgK8RZSOaBR/N8e+6OaUQA9+mL9OMkhanWM U1TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NKKahgVQmXfUfXn2BJolmwRQuha3ZmdJxDzKc1VCVmQ=; b=PUD563zIHESjzeGVGWS3JGKkR8kFRBAgpp1FzmS2XViwRdt46A8C7NaHxL3KWRuKC+ UQeIClZO8qENmczes9vfZY1oBn2ISWMK/wf/BRqxUWQQYCuc9+etTLZBgbFpg/J4CBt4 QEcGtNKi0LwbFsGiuCj3A5Lt9doLta4BAwr6zLcXUqyAI3Ld1bmqtOw2Kiohvl/KsjFo NHcTZ8bA7b8LHGKLrRO6mIEZhKseRPWi3BlyVgRAhZ2J2JW0BsbS02XHa3aniTOdxK1m j0sJUX9RYQnwPhxr8iyW/ruEdqBkxteFh0APVwm96KgaD5g50eVD7Nosc7UABLku5m2X qjXQ== X-Gm-Message-State: AOAM532hcd88k/eWHxlYf0RPZF/FMge5V1X9P3bEWicZ1TKRNSM6mQMK penhOGeTsoybOyT5apTN3MI= X-Google-Smtp-Source: ABdhPJyfWG1M3WdUMt8v9+xHg5aNTQLHvpE1TfarKBtyVNOkRFgeFW4VI72JI5viii1Vg54/tEbmBA== X-Received: by 2002:a5d:5344:: with SMTP id t4mr9985952wrv.267.1602944232120; Sat, 17 Oct 2020 07:17:12 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id i33sm9130623wri.79.2020.10.17.07.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2020 07:17:11 -0700 (PDT) From: Alex Dewar To: mchehab@kernel.org Cc: Alex Dewar , Dan Carpenter , Sakari Ailus , Greg Kroah-Hartman , Linus Walleij , Alan Cox , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] staging: media: atomisp: Fix error path in lm3554_probe() Date: Sat, 17 Oct 2020 15:09:46 +0100 Message-Id: <20201017140950.15989-4-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201017140950.15989-1-alex.dewar90@gmail.com> References: <20201017140950.15989-1-alex.dewar90@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The error path for lm3554_probe() contains a number of bugs, including: * resource leaks * jumping to error labels out of sequence * not setting the return value appropriately Fix it up and give the labels more memorable names. This issue has existed since the code was originally contributed in commit a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2"), although the code was subsequently removed altogether and then reinstated with commit ad85094b293e ("Revert "media: staging: atomisp: Remove driver""). Addresses-Coverity: 1496802 ("Resource leaks") Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2") Signed-off-by: Alex Dewar Reviewed-by: Dan Carpenter --- v5: Check for error, not success (Dan), but do it correctly cf. v4 :) v4: Rebase v3: No changes v2: Fix a couple more leaks on error path (Dan) .../media/atomisp/i2c/atomisp-lm3554.c | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c index 7ca7378b1859..b38df022f880 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c @@ -833,7 +833,6 @@ static void *lm3554_platform_data_func(struct i2c_client *client) static int lm3554_probe(struct i2c_client *client) { - int err = 0; struct lm3554 *flash; unsigned int i; int ret; @@ -843,36 +842,38 @@ static int lm3554_probe(struct i2c_client *client) return -ENOMEM; flash->pdata = lm3554_platform_data_func(client); - if (IS_ERR(flash->pdata)) - return PTR_ERR(flash->pdata); + if (IS_ERR(flash->pdata)) { + ret = PTR_ERR(flash->pdata); + goto err_free_flash; + } v4l2_i2c_subdev_init(&flash->sd, client, &lm3554_ops); flash->sd.internal_ops = &lm3554_internal_ops; 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)); + ret = v4l2_ctrl_handler_init(&flash->ctrl_handler, + ARRAY_SIZE(lm3554_controls)); if (ret) { - dev_err(&client->dev, "error initialize a ctrl_handler.\n"); - goto fail2; + dev_err(&client->dev, "error initializing ctrl_handler"); + goto err_unregister_sd; } for (i = 0; i < ARRAY_SIZE(lm3554_controls); i++) v4l2_ctrl_new_custom(&flash->ctrl_handler, &lm3554_controls[i], NULL); - if (flash->ctrl_handler.error) { - dev_err(&client->dev, "ctrl_handler error.\n"); - goto fail2; + ret = flash->ctrl_handler.error; + if (ret) { + dev_err(&client->dev, "ctrl_handler error"); + goto err_free_ctrl_handler; } flash->sd.ctrl_handler = &flash->ctrl_handler; - err = media_entity_pads_init(&flash->sd.entity, 0, NULL); - if (err) { - dev_err(&client->dev, "error initialize a media entity.\n"); - goto fail1; + ret = media_entity_pads_init(&flash->sd.entity, 0, NULL); + if (ret) { + dev_err(&client->dev, "error initializing media entity"); + goto err_free_ctrl_handler; } flash->sd.entity.function = MEDIA_ENT_F_FLASH; @@ -881,20 +882,28 @@ static int lm3554_probe(struct i2c_client *client) timer_setup(&flash->flash_off_delay, lm3554_flash_off_delay, 0); - err = lm3554_gpio_init(client); - if (err) { + ret = lm3554_gpio_init(client); + if (ret) { dev_err(&client->dev, "gpio request/direction_output fail"); - goto fail2; + goto err_del_timer; } - return atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH); -fail2: + + ret = atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH); + if (ret) + goto err_del_timer; + + return 0; + +err_del_timer: + del_timer_sync(&flash->flash_off_delay); media_entity_cleanup(&flash->sd.entity); +err_free_ctrl_handler: v4l2_ctrl_handler_free(&flash->ctrl_handler); -fail1: +err_unregister_sd: v4l2_device_unregister_subdev(&flash->sd); +err_free_flash: kfree(flash); - - return err; + return ret; } static int lm3554_remove(struct i2c_client *client) From patchwork Sat Oct 17 14:09:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Dewar X-Patchwork-Id: 11842739 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A15714B5 for ; Sat, 17 Oct 2020 14:10:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E28862072C for ; Sat, 17 Oct 2020 14:10:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GbLWpBKM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438256AbgJQOKn (ORCPT ); Sat, 17 Oct 2020 10:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438252AbgJQOKn (ORCPT ); Sat, 17 Oct 2020 10:10:43 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFF2C061755; Sat, 17 Oct 2020 07:10:42 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id x7so6623128wrl.3; Sat, 17 Oct 2020 07:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1t1qKTOcHJuHJHJsb4p8ik2mZczxzfF5ELYPkpoZWUg=; b=GbLWpBKMrdXEd6HyCuPGNMB5P3R96WSNhFqO55ycZBa0IQM3aXrHpxAfyh0pHBdzZK Kcurg3yXtC3pilHBAg2L4dp+ICU+nJ8TKZAg0N6SvRIMx0L6sXOi9Ne5VDx/v0e4GWYd mGJZNOv0zAJZsIwYgQaEouYBHyVh9pBV3iGpHmaa+tCKSDvU5UUMGeiLm5y1/yA2K0ww ugIJWC/N9JeRPoHSkV4lf+4jGmnF9IpqZwAjwdpunDqydq90UOshhabjsAYS9RJfTIql nhTVbx6AIApVgSovzG7eMaRBUYm8qe2vIjVDp57Xjo6PrifSxMzNv/Yaxl1vHccaaxxM /Z0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1t1qKTOcHJuHJHJsb4p8ik2mZczxzfF5ELYPkpoZWUg=; b=RphK8glFZSUts9m/OYvi38SjQPVCMUU5dDOtty/Me5XPyuMBDSycReG7K/Z8yVGJhr 1idOzPIkj0Qdh2yhTyLVGAFFuiGVd+Tw8fNIgWPxhoXXv2JgN7h3r16/f1BeqztllRuD mJDzrs1uhVSm+PgS9dbZMxol/ms6vW+NPHDT8SjJNhoeJMT2Pk5ZmxwqfAas9mfcB/av 3Z0/llSJWqPJFKhm6kiOOaFE2IH6OrhbtmVMTIMGzmhWP8cz0bzDslzD5rhs00++li9y LHio2DcH0qsBLFNopUhV807FykVmV0ljQB7452rhq2mGYBAS0yKdj+cvBQ6k4TXLYLYe stpQ== X-Gm-Message-State: AOAM532ENEvEPFQXPSDKR3lC1JXCwqMn+EMGc66nXwOH4zo350N3Ro25 EwuDGsSdjgYDTS6Kbbs4voY= X-Google-Smtp-Source: ABdhPJzfcA0ECFdHtCngcWj3sFyHuPE35S+QknUbVboMYZkEumlRCEpQGIboB4PdiQ67c1SMEBlOAg== X-Received: by 2002:adf:9069:: with SMTP id h96mr10853710wrh.358.1602943841407; Sat, 17 Oct 2020 07:10:41 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id i33sm9130623wri.79.2020.10.17.07.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2020 07:10:40 -0700 (PDT) From: Alex Dewar To: mchehab@kernel.org Cc: Alex Dewar , Sakari Ailus , Greg Kroah-Hartman , Linus Walleij , Dan Carpenter , Alan Cox , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] staging: media: atomisp: Remove unhelpful info message Date: Sat, 17 Oct 2020 15:09:43 +0100 Message-Id: <20201017140950.15989-2-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201017140950.15989-1-alex.dewar90@gmail.com> References: <20201017140950.15989-1-alex.dewar90@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We don't really need to know that the LED pin reset successfully. Signed-off-by: Alex Dewar --- 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 b38df022f880..0043ae8e2ffa 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; From patchwork Sat Oct 17 14:09:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Dewar X-Patchwork-Id: 11842741 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31AAC14B4 for ; Sat, 17 Oct 2020 14:11:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 096D220756 for ; Sat, 17 Oct 2020 14:11:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hCV4R2HX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438267AbgJQOK4 (ORCPT ); Sat, 17 Oct 2020 10:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438264AbgJQOKz (ORCPT ); Sat, 17 Oct 2020 10:10:55 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71525C0613CE; Sat, 17 Oct 2020 07:10:53 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id 13so6166883wmf.0; Sat, 17 Oct 2020 07:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oVtD9RxYC46FZp/4Rt/dwhENN40PjOjFpcIMXcrNbK4=; b=hCV4R2HXld7SixgoJg0qXzjU6obJcCLi+EZoMPol7oN6NILOCux99UZYGVF9ec2rRG ENSezx9zYGBrrrh3BzVYpDR26imGQJfxjXBFHs9DEqNYKEjKFV31XK9Lx+yvTefNB1yS ALuec8B+Y4RAjk2YK+ulRJKxurSMRTIWdOXB0NMKHmwLqBG2UqaLRLYBIkkQ+Nd1Wzsy XVG5RRcxlX2dIb6jyr/2fwEKY7leazPqnY7WaiMJsVNcaa1infgSiufNIr6sH8sHWBg1 1tIQnS0q59pf2drHoYy0Jhpn9EwAlKOmjeKtlIFyZasXYV+2go235s1yHasje9ffIyp2 0dzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oVtD9RxYC46FZp/4Rt/dwhENN40PjOjFpcIMXcrNbK4=; b=RtdobqqZIwP9dCbU8nhAB3dgHctP1MjHlCca60fBUGYec6T2vlv0F0lzsXVt3s5Mbw gMgJwVodP3EL1Wd4ax1yK9O5FayT5EnUrSwMLTsopy5lUYlAGdADd7Rj5ohy4tPXT6aq 962YBZ/MxbJXKIrDiuuyJKQDUAjujHS7caB7qQZbPWBYEQCFGeG6+lxsyUJQ4DoU6foe 2Pr8PTfxzxodDoXcoqqVCMVYbiZ8eFfiaBMg/7IrCoOgB4UFkgnOBW8Mc5ZhTR2qR78Q fdgLYmqB6C9FtiSx6Yc4uwDrtAGKsCX7NhPNpwM8Swdtt167b5yG8kDG7BuDi9M/gI4a 0BLA== X-Gm-Message-State: AOAM530aL1veAWfrXA9J6V83DuzKNz8gJZuV4l7NX4ddX2mcbzeFUbiO ePvqNAc6/cvh6l2B5twYuwI= X-Google-Smtp-Source: ABdhPJynHPJT6NIPtEuDClzehHGLcvQi2blrC9jrkrofTu+615BYm9ykBHnc/IFJf2y0RGOYDN1bfQ== X-Received: by 2002:a1c:2901:: with SMTP id p1mr8947923wmp.170.1602943852107; Sat, 17 Oct 2020 07:10:52 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id i33sm9130623wri.79.2020.10.17.07.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2020 07:10:51 -0700 (PDT) From: Alex Dewar To: mchehab@kernel.org Cc: Alex Dewar , Sakari Ailus , Greg Kroah-Hartman , Linus Walleij , Dan Carpenter , Alan Cox , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] staging: media: atomisp: Don't abort on error in module exit path Date: Sat, 17 Oct 2020 15:09:44 +0100 Message-Id: <20201017140950.15989-3-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201017140950.15989-1-alex.dewar90@gmail.com> References: <20201017140950.15989-1-alex.dewar90@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- .../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 0043ae8e2ffa..44c41a0119a1 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) @@ -909,7 +909,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); @@ -919,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 = {