Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp455845rwd; Sat, 20 May 2023 00:23:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6l0te0FAXMT5LMz71lDOu1n5W2NDEEIO9bFvpN3FGL7yOjeA316MliLTADXZ/lllLNMgXB X-Received: by 2002:a05:6a00:1814:b0:643:90ee:587 with SMTP id y20-20020a056a00181400b0064390ee0587mr6582335pfa.18.1684567425075; Sat, 20 May 2023 00:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684567425; cv=none; d=google.com; s=arc-20160816; b=ijXWtPPfVPtWkGGRRsbnW95u9F+OZvsRrUxyvR+cvUsMO6hCNgHm+uMeuhf7qtCPOU aXUiXNBPH2jjLD6Xg8lWfO0qCRlcKm15bSjdPNKz7Y3oJYkLlL0bl8wLrgVuRU3nLHf2 AENx1H/toPeR4ynpi6qKzittrNVGyL6jIU0RtlVp5ote270b8MBikgIv1RI9Q5AEXxdG I7o0BBYlRYPcHYfgNSlIvJfbTATQLzrlfjlKVSPGIx9+FXPIHPAT+L1dTLm4Xad1+BZ4 C/MW6HeQPIB7pipOMhnUgHGsB5RaFRqD+a7OlpnBOAmjb00Qz0H3+znaZ64cvVdHmr3F f/mw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020a637903000000b005303c098a92si1042402pgc.346.2023.05.20.00.23.33; Sat, 20 May 2023 00:23:45 -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 S229762AbjETHLE (ORCPT + 99 others); Sat, 20 May 2023 03:11:04 -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=20Canal?= 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 Content-Transfer-Encoding: 8bit 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 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) -- 2.34.1