From patchwork Sat May 20 07:10:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 96736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp201482vqo; Sat, 20 May 2023 00:20:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77BAygPuXAg2uGUaj/vfsXbeNi73OKLq+F8kpX6cojtRe1uzwtA+UeIUkkBsFCqPtrbeIY X-Received: by 2002:a17:902:d70b:b0:1ac:a058:555e with SMTP id w11-20020a170902d70b00b001aca058555emr4335150ply.8.1684567253673; Sat, 20 May 2023 00:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684567253; cv=none; d=google.com; s=arc-20160816; b=0Di2sCJM7ZPsdxaFgZ5MfPJA1TtFvIAvLZsceY6O+sTNVT+gdsMabFQeo9NLY2bI/t QdhbDw15lNAmJJiD8tILMmG2+h5EblyX6xWehAmZKfgmcERoCktUgmieEDYY+oQ2AJYu /2I7bL6o/YkbjRXmKqM2Sp5z3drX0NpdBZSQYTWTx1QeHW4TbOuQI5MmxogoKwoPmJk6 hCC7xfgArtTze90/RMEIGpcizx7FCNqnlSqs7Pl9dICFADITsflBVNpMR4oMQGnrg61K a0rJpuV1w8vjpNnnxGnjBbS3tss9qZ48tQ8fcy7K5ubvTiIeKOvJhi2Lo5JKCNYUqWL0 DavQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZdHX2ENYCr6jKauhqqWQ2NeyEOo+ci9pQnDa5o7LLQ4=; b=bq9LLFNFvl3jeJAEsh/S4dQB6mogCen5qCCCvLnyee406BsB3usTcP1C2IyvskS9I8 m7DJpesCDLRzLnixai93m3282VQunZWxH+qfZqsuWB+qhdYUjSFjcR2sUmSVroB4ygvf iPG4YceRnEzVsd3KGqUorgOERT0OZEkLKKX8vey2pNQdO6M9uDzgonEAIeEZFagmSkV2 9hQ0zyoF2uTcmYAqkVXHOGkLtZldxIbWd2ibAfTx8bc/ChzS9NEiEkf2iyyGQEYvGsT1 g1swrL1zsnozCWEaL14aD5MJhTnNurRXYZX0ZPqWPLTCOJsQoUMw29BYE9SH34U0mAVz 8ztA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=Lk3CsbJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020a170902a38100b001a988a09b6esi952878pla.252.2023.05.20.00.20.32; Sat, 20 May 2023 00:20:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=Lk3CsbJV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbjETHLF (ORCPT + 99 others); Sat, 20 May 2023 03:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjETHLD (ORCPT ); Sat, 20 May 2023 03:11:03 -0400 Received: from smtp.smtpout.orange.fr (smtp-20.smtpout.orange.fr [80.12.242.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1DD3E40 for ; Sat, 20 May 2023 00:11:00 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0GjwqX2OKqmw80GjwqRTUl; Sat, 20 May 2023 09:10:57 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684566657; bh=ZdHX2ENYCr6jKauhqqWQ2NeyEOo+ci9pQnDa5o7LLQ4=; h=From:To:Cc:Subject:Date; b=Lk3CsbJVD1weK7t2DnluWEMeMdnfgTokN57Q4M8Rs72nRj7L4EOzrkvxTXgWYSvln Zm66Mc+/RVfnJboMdS4gBpCsp/5JMLEx2hFbsKG+jATGGKz5tyTCfCHI7QI4anoBhe xukQZEsVLRTX7+d/WtHelmOP8KAIsWPuPHOd+qvJ9ltpYmM5pBDBwl0fhqstShZnkt 3sNTOWJpZ+6HQLpvlAXzguCz/CO4aNmCAWRdaCprMTunXlgQRm7w3aKSfqmyGpWQtn 8+MUFequeh3R28ei4LNT9E4qBZSWhd7OFDThXv13JmbzzTyD60gZPwOK+a4f8Lp+ME 6qwfTmIjIGn0Q== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 09:10:57 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Lee Jones , =?utf-8?q?Ma=C3=ADra_Canal?= Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Lee Jones Subject: [PATCH 1/2] mfd: wcd934x: Fix an error handling path in wcd934x_slim_probe() Date: Sat, 20 May 2023 09:10:54 +0200 Message-Id: <02d8447f6d1df52cc8357aae698152e9a9be67c6.1684565021.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766396792527170770?= X-GMAIL-MSGID: =?utf-8?q?1766396792527170770?= If devm_gpiod_get_optional() fails, some resources need to be released, as already done in the .remove() function. While at it, remove the unneeded error code from a dev_err_probe() call. It is already added in a human readable way by dev_err_probe() itself. Fixes: 6a0ee2a61a31 ("mfd: wcd934x: Replace legacy gpio interface for gpiod") Signed-off-by: Christophe JAILLET --- drivers/mfd/wcd934x.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c index 07e884087f2c..281470d6b0b9 100644 --- a/drivers/mfd/wcd934x.c +++ b/drivers/mfd/wcd934x.c @@ -258,8 +258,9 @@ static int wcd934x_slim_probe(struct slim_device *sdev) usleep_range(600, 650); reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(reset_gpio)) { - return dev_err_probe(dev, PTR_ERR(reset_gpio), - "Failed to get reset gpio: err = %ld\n", PTR_ERR(reset_gpio)); + ret = dev_err_probe(dev, PTR_ERR(reset_gpio), + "Failed to get reset gpio\n"); + goto err_disable_regulators; } msleep(20); gpiod_set_value(reset_gpio, 1); @@ -269,6 +270,10 @@ static int wcd934x_slim_probe(struct slim_device *sdev) dev_set_drvdata(dev, ddata); return 0; + +err_disable_regulators: + regulator_bulk_disable(WCD934X_MAX_SUPPLY, ddata->supplies); + return ret; } static void wcd934x_slim_remove(struct slim_device *sdev)