From patchwork Tue Sep 22 09:09:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Dewar X-Patchwork-Id: 11791921 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 31C4F16BC for ; Tue, 22 Sep 2020 09:09:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11BAD239D4 for ; Tue, 22 Sep 2020 09:09:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g0ztxOEM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726503AbgIVJJb (ORCPT ); Tue, 22 Sep 2020 05:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgIVJJb (ORCPT ); Tue, 22 Sep 2020 05:09:31 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0423EC061755; Tue, 22 Sep 2020 02:09:31 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id z9so2528232wmk.1; Tue, 22 Sep 2020 02:09:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=L/ZWeHl6g9bUEvH+gQEPwLwoUq+BztRlCjrFqFnljXk=; b=g0ztxOEMt/jmegCCvzJU/6SWUYqIzblEoxWWUZ+5c3gww4z/Z1xoq92CV4flM3R2QN IdqCKOy1Op357euSOS5rPksXkrWrvvd9IZRBG49vjuIo5TBnhW5Hbj9uQg5HTSWyrZK+ 92L9AoksxZ0wYR6B1a73F/cmBTZbXbosv3jnh4mXHGx26QBCV1z6c5aoVVKt6aP059CS /7WYqn0NiJUdfmIGBwmyJjaO3QMAup/LfO+dZLtjYvf7HT2tZI7tVX85s/Nzu1yxjYon EtpfYqzXvbGGdUlXv1JDVH/6jiVe72SY9UCM9Yz4NEyn3pE82tR/bsqX5aGAvdYPS0eU DHDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L/ZWeHl6g9bUEvH+gQEPwLwoUq+BztRlCjrFqFnljXk=; b=MyisIo6cT1bpD0dciklNNYpguJCPVHEKsHwmPEJWjsM0zogGw9SlSvoMSRlQal/xLH tzSEVKW2y0vpefJoZ3HIkJ+5exJ2P3hqai9aM6WuFdh1xzcYFOwHJgsK2veYakLdBiMv ebA1WPG73zGmMmkVXVjvP5pUnDPNxe5sOUzk7lk+wbM4iQSsSi19jugJeEWn1aMZHrvD rCdYNFUhiter6uQe4iRzSJ/ZyVyBGfloThi52Cwz2sOBireifWoF6U9kOakeTLAxqTqJ N70AJLzRu+nMiUAHMqVPWsdW2m9J7O54klgLETEOoTekmvpxotSY8u7+6I7WKum0ytQ8 AikA== X-Gm-Message-State: AOAM53006+fhaaWXpfbnyWi5GapJbfsreothPLsvGceFmmczgdlzJ+NP FGZyoe+TWGdDe6iRT6W8b+Q= X-Google-Smtp-Source: ABdhPJxtd4d7v+unZk6JNUqW3InJ4pYveO61JlckrtqdlXfDjo6tzPjRA3tCQ57oJIX48ktf+qShTA== X-Received: by 2002:a7b:c0c5:: with SMTP id s5mr3385881wmh.152.1600765769668; Tue, 22 Sep 2020 02:09:29 -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 u186sm3659332wmu.34.2020.09.22.02.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:09:29 -0700 (PDT) From: Alex Dewar To: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Alex Dewar , Dan Carpenter , Alan Cox , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH REBASE 1/3] staging: media: atomisp: Fix error path in lm3554_probe() Date: Tue, 22 Sep 2020 10:09:08 +0100 Message-Id: <20200922090914.20702-2-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200922090914.20702-1-alex.dewar90@gmail.com> References: <21f18dc2-a1bc-0a37-0336-fc35170a40e9@gmail.com> <20200922090914.20702-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 --- .../media/atomisp/i2c/atomisp-lm3554.c | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c index 809010af7855..67e62b96adf9 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c @@ -847,7 +847,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; @@ -863,28 +862,28 @@ 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)); + 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; @@ -893,20 +892,27 @@ 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) + return ret; + + 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); kfree(flash); - - return err; + return ret; } static int lm3554_remove(struct i2c_client *client) From patchwork Tue Sep 22 09:09:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Dewar X-Patchwork-Id: 11791925 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 F27AF139F for ; Tue, 22 Sep 2020 09:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE915239D4 for ; Tue, 22 Sep 2020 09:09:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uN4TPm80" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726548AbgIVJJi (ORCPT ); Tue, 22 Sep 2020 05:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgIVJJi (ORCPT ); Tue, 22 Sep 2020 05:09:38 -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 F05B4C061755; Tue, 22 Sep 2020 02:09:37 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id a9so2525535wmm.2; Tue, 22 Sep 2020 02:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=r57iWCuDHaIWumoTfNxqkUyAoNSMqRJV6vH8XsPaOWE=; b=uN4TPm80jYkdN2XC8RAifrlrA4q12X3NAOIzWS/FS3Ib5qwbI7zo4U1iIdhS506IsW 4Fmizz9zDx/iGQUgQ7opItOr9jOi6XoYAq60+o0qHsCSIMBOHxyQhNG50V4xPTrbn3Tn Zq7hoEG6ers70G5UjbEeGAbyS+o+6FL3/TXT8lDidnN0CtvGLhZ9AYYR/zNVA4Cirpvb QnUzG9gBCA8b35dbZtk4ogZjfnnq68f1MWy16zbJ2kRzJyZBdEsD0YI6w6qmM+DG1xqg KhjR3x+HqpFBVbrNFQ1Y3XWNzCaHrqfIHVmSFFsdneM4VtvTEiVms/LNYqEyqzKN5u5n LKDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r57iWCuDHaIWumoTfNxqkUyAoNSMqRJV6vH8XsPaOWE=; b=JxHI8g1grXXtAllJxYkg/It5WsziOqySa8rhmlDfMcBVkKa+H6sF7SnU1trFo31iA/ WV4Nmtb/0nZe8/ws7op68iVmdJynNSxx2cS2cDQfXW5vrLEfbylc6Ft9J4JNsE8vASCv bXxV4ua4vjTVYDxKZ6JdXvn0rDovNAVr0BqoDwc0+Qjr5+QatfxYpMUaXzCYJJ6E2q0u gVvPvLa8fRBsuXA7EfmVArWyGdn6Hkb4sKQThoLPsCrZEKdR4qz49WLBAu+uET78i5et v5nlbKd0zoW/wnBN9PVNm5RrSx4A+r69olTEqykX1WwYCOhT37Hqtx3PR9nN+wB8Myz+ XCdg== X-Gm-Message-State: AOAM533F6KzjEpB5xf02xKodRLzx4u+75KEIvkouNe92F8bhjaxLqis2 4TpKb7q1I7DjCW0x3/FcL28= X-Google-Smtp-Source: ABdhPJy/tuF8IskuK9u88sAZfrDy+NdeScFVkvl1Ds3OvsDQ6LYn4XC5UFFeMXSvCqSHDRGACRAkzA== X-Received: by 2002:a1c:8115:: with SMTP id c21mr3499169wmd.153.1600765776638; Tue, 22 Sep 2020 02:09:36 -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 u186sm3659332wmu.34.2020.09.22.02.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:09:36 -0700 (PDT) From: Alex Dewar To: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Alex Dewar , Dan Carpenter , Alan Cox , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH REBASE 2/3] staging: media: atomisp: Remove unhelpful info message Date: Tue, 22 Sep 2020 10:09:09 +0100 Message-Id: <20200922090914.20702-3-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200922090914.20702-1-alex.dewar90@gmail.com> References: <21f18dc2-a1bc-0a37-0336-fc35170a40e9@gmail.com> <20200922090914.20702-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 67e62b96adf9..5e895586e80a 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c @@ -772,7 +772,6 @@ static int lm3554_gpio_init(struct i2c_client *client) ret = gpio_direction_output(pdata->gpio_reset, 0); if (ret < 0) goto err_gpio_reset; - dev_info(&client->dev, "flash led reset successfully\n"); if (!gpio_is_valid(pdata->gpio_strobe)) { ret = -EINVAL; From patchwork Tue Sep 22 09:09:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Dewar X-Patchwork-Id: 11791927 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 9C2D6112E for ; Tue, 22 Sep 2020 09:09:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79C85239E5 for ; Tue, 22 Sep 2020 09:09:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VDVoXwPd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726567AbgIVJJq (ORCPT ); Tue, 22 Sep 2020 05:09:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgIVJJq (ORCPT ); Tue, 22 Sep 2020 05:09:46 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD7EC061755; Tue, 22 Sep 2020 02:09:46 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id o5so16149535wrn.13; Tue, 22 Sep 2020 02:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9Aesl8jwzB6h2AKl/DvTFdtB5ZWXuEURqgA0oOLGpZk=; b=VDVoXwPdoJzIDGxF1A9mAviiE0oyBHXTdSoaOLdOMRkoDxY/8EjbP/M/hoDlL05FOf iFKH0tIHHDHVnRiat7g7bcA+Hoq0o+i12qc6vh8Knf8/jUbDjMSJkvxWGJH6g6syZpNa YaQ0gxbJt9hsUsnMU7pEiPT/Cnx5LkQmCtXqSrP5mbYBaTJD98ohQ1d4tpvWixkjkLX1 ehV98iaRuyhb5MiUaXUokNCajML3S57KeHYcpXzEfmOcg5RVJ6V6KStH7goxfbWjRtFf BnVmZiDA2d+8Uk5zcsrA9Pnn17BqWXFesH/HX/BaB9yggxlSnhSEVVPPr47B0hqC4K+r c1BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9Aesl8jwzB6h2AKl/DvTFdtB5ZWXuEURqgA0oOLGpZk=; b=re5dUTr29xFGpe/HmAncKpxFaFky0VmMjrGRdB7AYNbEA/cItHKXP0RYMo9cRQDD/J OoDkxk+UpOYZWeGOKxNXDOkRv77Q9Y8oSCKP+Rdj4MxD41mE7I/dw9P5uTsaXj+5sH5A vbrPH3WA7qmzamuLGGNf2nlYobHenJwqnxxjufSZKW6LTxetD51846cRBoy09B71/S/G V4sW9SqZkajRy5w2GpyU2GdJs9sbh38vqWJCzfi2fYfHXXxZSJJ/omluFyLPqzgOtsvB pY9j7D9hAtaL2hx/zeTaq0i6GUindXP9JelRA8Qi4Am0bXZdqFdcBwf2Y/r/HWRj+7KL hS9g== X-Gm-Message-State: AOAM5306L8wBsgHXlaYQfilbfT3AJFPxPQWioPV/xfLiBqgii82fuKOE 7Xryk4BxTBrUqiEwpn5JxI4= X-Google-Smtp-Source: ABdhPJwwHB5mrPn87uWKoQZJjdNbWKBVf+VGCOSSjlZlRj5745cpIvJcM1poRmEQGc01rJ3g7/LCRw== X-Received: by 2002:adf:e391:: with SMTP id e17mr3947261wrm.289.1600765784834; Tue, 22 Sep 2020 02:09:44 -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 u186sm3659332wmu.34.2020.09.22.02.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:09:44 -0700 (PDT) From: Alex Dewar To: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Alex Dewar , Dan Carpenter , Alan Cox , 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 Message-Id: <20200922090914.20702-4-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200922090914.20702-1-alex.dewar90@gmail.com> References: <21f18dc2-a1bc-0a37-0336-fc35170a40e9@gmail.com> <20200922090914.20702-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 | 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 = {