Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp637940pxk; Thu, 3 Sep 2020 08:52:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR3cAfalB0ku+YRXaPWOFr0mVbLX8jZOZ4NUSv4wGyg8taDurGBNaFb5iIm1V/EOOPBjNj X-Received: by 2002:a17:906:768c:: with SMTP id o12mr2727582ejm.269.1599148346910; Thu, 03 Sep 2020 08:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599148346; cv=none; d=google.com; s=arc-20160816; b=0YMBKITUQtAc+++nJkXCNH405T1EgMEuhMqYFK3pCDVWtdQHFLsGpAeAM4trogfX5s 4vYO91MtQTnq47SGmAIjF1/CkDTf+OXkE99MgJS8Meivcw/vqSFdxr3nG2wggUdTWZmz 9xAIZA2TOYQALtrUuBd/N0tWkML+uUAmYu/ILX8fy0ZbUSDu2uOM0k3WYhF1rcr83l74 QYy+5nY9B1PhunmegHqXO9LjnIe8D1A47R77qPhpx4mXcpG/9COOeJpaxU+7t42f3auN 7TktohjPK5f/Zjqu1fyWWxg9JS3+eScjEA8eC7LIN70q0cpgcyCAZvxG3hg3SX4Rp2Es UETg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=OPj9d30CAARqGx+bikPSsEnUWXOcRX7Mxe5aMa8ahCE=; b=Nq1KTIVtYj8rqPZe52rJ82ZeMn3fCkvdDtknt26KaWYJKreCgTh/4YRBfplgO5B7Fm hmf6pG2UOB/gYpE2CBUTQmUncbzwgCWfyxnis4Vfn+hzF7PwArgO42W3zGjB1HG7jWfI wrVry37WGN5uyVC+96aSzid5JYMZEKvaW2aSrWue2S8uUuyT+myXipr9Ga+K2UOCCFN9 hi4EPyBk2K6+PliN+MVkD6SJ1KX1ZYZwpqNFzqhrJ0rpLJPgIHxtd/7ziTF9F0W00QgL tyRznal/GvJC+BVuXT2pkECzYaivrB0PEHn+NQOJUEIoP8ylP39DfsYaOp3qmTfOBo7n RCrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fv+ELy+K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt14si1664914ejb.133.2020.09.03.08.52.03; Thu, 03 Sep 2020 08:52:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fv+ELy+K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728618AbgICPsr (ORCPT + 99 others); Thu, 3 Sep 2020 11:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726025AbgICPsp (ORCPT ); Thu, 3 Sep 2020 11:48:45 -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 20549C061244; Thu, 3 Sep 2020 08:48:45 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id w5so3761098wrp.8; Thu, 03 Sep 2020 08:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OPj9d30CAARqGx+bikPSsEnUWXOcRX7Mxe5aMa8ahCE=; b=Fv+ELy+K8p1TzkuFzHURU8ULrabjLy/GA+gzrVslyT9VOYD/zzcxlCRarBUx24WKrr j5Zr67a5zMLy7bfYFOfwlVMhz0E9e2ZT1vbriU7KZwnmIfrI+Vvgk/eBjxqJ5U60a7n8 8qXKrhUyNu+W5a3GLvwkqwPEcZoFmGBsfTsLAVqsgZS0j4L2k9ovbYqObZHMpPMoDAYG bxUfk47jrPQJXDXj//x4zgv++hYgtm05jEFuPueuVK4kNvaM8ywNZyeWHHhRnP7ji5oW Gy4tjKcYBr1v93ZJTIKinzVU8XXLMKlP2jGlJ2JLd3wPZMjg1lyL3vvEmGRB9/0ZM7C2 5w3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OPj9d30CAARqGx+bikPSsEnUWXOcRX7Mxe5aMa8ahCE=; b=pyMrYsylGaximgyfSuMKHOn0tuQubyOhOTd8Cj+UV1UkMTgqZuNZugeko+v7q7nr7e W0Sehy9DP8gqkZwp1ui9EAI1/OlAMBb++lUqaOGG80sDY62fdo4LNzsLDFZiDY5g58AW OZaR4hA+6xqZQ9qBiYSUam055fQQxPx2Vqhf0gpcoMwO+5aEiHdsj7qJJ1Em7mFOQwDz ujRWKJEw4QiObvFsYh5YhDb9C97ZMtmwc8KN4lQJyvKLG7InRwMYI+cV37nF3OXMeDEM 72ZIZ9RMtu0PilRiyx4rCBAkN8i6T3YkOEwnnmaUEpvXBtq+rzM/QFJ/D8wEdY+yePAt o9vQ== X-Gm-Message-State: AOAM532IGRibxczIFO6RSQ7JnptE4SP+eSm6DHaaasL2Rzh672/y57CR J6ACyea/j168Qxdvgng6Tc0= X-Received: by 2002:adf:f78c:: with SMTP id q12mr3157273wrp.6.1599148123691; Thu, 03 Sep 2020 08:48:43 -0700 (PDT) Received: from medion (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id x24sm5546173wrd.53.2020.09.03.08.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 08:48:42 -0700 (PDT) From: Alex Dewar X-Google-Original-From: Alex Dewar Date: Thu, 3 Sep 2020 16:48:41 +0100 To: Dan Carpenter Cc: Alex Dewar , devel@driverdev.osuosl.org, Greg Kroah-Hartman , Linus Walleij , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Sakari Ailus , Mauro Carvalho Chehab , Alan Cox Subject: Re: [PATCH] staging: media: atomisp: Fix error path in lm3554_probe() Message-ID: <20200903154841.w5rppm325jobimud@medion> References: <20200902184207.479525-1-alex.dewar90@gmail.com> <20200903121134.GB8299@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200903121134.GB8299@kadam> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Good point about the timer! > > > > - 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_cleanup_entity; > > } > > return atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH); > > If atomisp_register_i2c_module() fails then we need to call > lm3554_gpio_uninit(client) and do other cleanup. I'm probably showing my ignorance here, but I can't see what cleanup we need. Inside lm3554_gpio_init we have: 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; ret = gpiod_direction_output(pdata->gpio_strobe, 0); if (ret < 0) return ret; I'm not sure how you "undo" a call to gpiod_direction_output, but I'm thinking you won't need to do anything because it should be ok to leave a gpio to output 0... right? Alex > > > -fail2: > > + > > +err_cleanup_entity: > > media_entity_cleanup(&flash->sd.entity); > > +err_free_ctrl_handler: > > v4l2_ctrl_handler_free(&flash->ctrl_handler); > > regards, > dan carpenter >