From patchwork Fri Jun 9 09:28:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 105497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp830432vqr; Fri, 9 Jun 2023 02:59:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UootGCBTqO/MxaPVszVpDVb1UejtrcMSpTJ3AGPuEAOyaPEx//AiLawlNF9rxFErGxQFc X-Received: by 2002:a05:6a20:c183:b0:10c:7c72:bdf9 with SMTP id bg3-20020a056a20c18300b0010c7c72bdf9mr506324pzb.29.1686304791302; Fri, 09 Jun 2023 02:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686304791; cv=none; d=google.com; s=arc-20160816; b=iUYtHDmii6ql9IlfAKF1ibALRVCxEhdtPmLO1heUk2bjbUUCfE1cqT0w1jgr00H2fA 6O4A/fGMy1TXF93gxEjmRDR7htT+KoGYHCqblaK7jIW7HA/b5OWcjluwXs3EDObBS9Nr SZuieBWBbZglEKE6W3BVbwvRB3bSnquiWsM9amoxLwK81MeX7iVjFSN1apHpY9xjjzAr qivDmMVDgvci3RjyWMnDNl5CXyrJtejnQ9J+0+5SndkFhCgBczmB8A+J280aZlCpaNht gOSkpjnRUa5Hu7O2Vw2ILPRMNmsbC28dGxFvITvpc+Xyc4GEu+3Ze9RtndhDgMwRuvw3 8Fpw== 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=GTqcvEeUANYaQZ0mEwT7i0/9oxw/QIgRkiDnAaUF2ws=; b=sFOckx7kkMtAdq0+OlLe284vIEv3dVVR8OVbkk2l1V+RccMIBkVEWqiD1XALwLpud0 vhAQyDpQC6T+IOb0/l6uzHB8L4WNwNr88jqw/OnVQpV7RCwolfwlFqchJQCzHRbGHCnp ZK+t0iBCg28Lg6FqZmS8xcECEdWbD39pbziOGxbhdAqae+g9NDEGZzpWU2r13cvntq67 +6IDIJtMuwbnO5+t6hd3G4GKfqMjbik37MtNptRine6Ouw9D2xx6gquZTe8EE7TPfqeB pdFe6CPBPYVulMxaWvxHLrYDQy7kawNKyFz76Iakaps3zpXAgnJH25sAmHS/vmFUpxlO CtOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=Jeyawc41; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a170903230f00b001aaf5dcd774si2622860plh.173.2023.06.09.02.59.37; Fri, 09 Jun 2023 02:59:51 -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=@foss.st.com header.s=selector1 header.b=Jeyawc41; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240036AbjFIJeJ (ORCPT + 99 others); Fri, 9 Jun 2023 05:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241390AbjFIJdw (ORCPT ); Fri, 9 Jun 2023 05:33:52 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FDDF421A for ; Fri, 9 Jun 2023 02:28:48 -0700 (PDT) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3596OEvp028054; Fri, 9 Jun 2023 11:28:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=GTqcvEeUANYaQZ0mEwT7i0/9oxw/QIgRkiDnAaUF2ws=; b=Jeyawc4155+H0e4WG6I2FHa9RALoeNNNlO2v6NM9Xot4Yp55e2fDQWunC2ynQp9vLIs0 EamGJhqP7k4l2NkM6dutYKtHPkB6djwW2AkZAKHBL+9a6VTgJX3wLyoxw33RySJXcJwW n9tRSEtVL8pkJwhVeTzLgpZYMnzhLj6c+Gms5sNA0WWHpn6WyYapTjKzOdDCCI5m5oPH ryL8HeS0RKA79EfR0wXL2jLCiXVXhJUmjcgZF2Dt34J3zYJ6vlcCyomf+fWMSk+Y8jDQ w5llwy6byy27k//nqL2NnsFLb6wXx4TYDVnajaVLkmhJY7ocKbJOtynYLMu/ABMq1ClG Jg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3r3xsf9bqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Jun 2023 11:28:15 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 32D5710002A; Fri, 9 Jun 2023 11:28:14 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2C988210F8B; Fri, 9 Jun 2023 11:28:14 +0200 (CEST) Received: from localhost (10.252.12.6) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 9 Jun 2023 11:28:13 +0200 From: Amelie Delaunay To: Lee Jones , Maxime Coquelin , Alexandre Torgue , Amelie Delaunay CC: Amelie Delaunay , , , Subject: [RESEND PATCH 1/2] mfd: stmfx: Fix error path in stmfx_chip_init Date: Fri, 9 Jun 2023 11:28:03 +0200 Message-ID: <20230609092804.793100-1-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.252.12.6] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-09_06,2023-06-08_01,2023-05-22_02 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1768218732996504262?= X-GMAIL-MSGID: =?utf-8?q?1768218732996504262?= In error path, disable vdd regulator if it exists, but don't overload ret. Because if regulator_disable() is successful, stmfx_chip_init will exit successfully while chip init failed. Fixes: 06252ade9156 ("mfd: Add ST Multi-Function eXpander (STMFX) core driver") Signed-off-by: Amelie Delaunay --- drivers/mfd/stmfx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c index f30c7c304147..54cc902cb578 100644 --- a/drivers/mfd/stmfx.c +++ b/drivers/mfd/stmfx.c @@ -387,7 +387,7 @@ static int stmfx_chip_init(struct i2c_client *client) err: if (stmfx->vdd) - return regulator_disable(stmfx->vdd); + regulator_disable(stmfx->vdd); return ret; } From patchwork Fri Jun 9 09:28:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 105502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp834597vqr; Fri, 9 Jun 2023 03:06:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7zL/i9tDd4dq17CutiEXKATfxSlzhxa8Gzzf8P0ww4Zv/RsDNp0dDJP1JkafptSsxXOuhr X-Received: by 2002:a05:6a00:24d6:b0:646:59e4:94eb with SMTP id d22-20020a056a0024d600b0064659e494ebmr730591pfv.15.1686305165701; Fri, 09 Jun 2023 03:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686305165; cv=none; d=google.com; s=arc-20160816; b=vbgAXIHhdNzdodJh+9o1OxCWP4Die3yCsK6oTQZ70hfKRxFkwhxSd4+P1Xgnl/lFD4 WOIEguDh526OIRjq9mnCghIlI9FfB01YfYYEkQfTIlJSha2h6YpQg5/8DEtEUswPL0Ro phNFUIB/OOVWakCsOiyaHxJwRJFxfMJIgcowejtjuyVFlX8g3ZS8Y7wayWS3kqX1Quru b9MC/7fZKUc+zb1/AakxZJ4C1sKEmxd0HgYOQ367/173Kud1WmPJQVf3zmsELd8bULry qwZxrmbgzTSaAkhOt1rB3wHI74tvWi9QOnGwhwPiKCk8cm8+8MSq8+qgjp4xUTMl7DkQ 1dxw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uRvepPfLBwDEe6cjr6Uk7xCGy1ySmdjO/0fLcxMhkcc=; b=ZBysYRQ30uROKPE5p9ikJmk+yYRJx1yjWNgNB3Bl2MkfRAqsIFXg/wH4mq+9JpNeOl epg4ET3prAnlP7ckRswbhAbg+HDkKcYeFHkr59zPcIfrP5boUKnSy3SsXdU9JARPdVhh gPyh0hincyx1D0bAfNGM7yoblfWIAitYTZfrI27yLxOvZM3B9IWU2bycMEUakRM5juuO dVxoAURpJ82nL1suciGJgWERmzlmnF3uYd3EN2QDC8kNEq/0yornlo/RqPJb/tZJpc3T IrJM3Px8YHfdPBAt0RsQCYE0y+wi9GNl3Jh4wjOkcaj3zKvIqummgYHwofEaZ4JBaLfw w3cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=FOeK+xuH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020aa79f91000000b0064e1b65f01dsi2222558pfr.237.2023.06.09.03.05.52; Fri, 09 Jun 2023 03:06:05 -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=@foss.st.com header.s=selector1 header.b=FOeK+xuH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241551AbjFIJeR (ORCPT + 99 others); Fri, 9 Jun 2023 05:34:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241464AbjFIJdw (ORCPT ); Fri, 9 Jun 2023 05:33:52 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B6FC421D for ; Fri, 9 Jun 2023 02:28:49 -0700 (PDT) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3599C3aW016809; Fri, 9 Jun 2023 11:28:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=uRvepPfLBwDEe6cjr6Uk7xCGy1ySmdjO/0fLcxMhkcc=; b=FOeK+xuHGS5cOI5dZSFhowwmrC6qXXCj8AZDVzWVKXwqGOIStqKOoqbe8UAqlX+dBgc/ RbGRqF8xlJulDlSr7aGpccJUYMEDXb0mV9VrHLASk6bRegc2k3noW/4SgrWWINTH5kVL wq7XwJCXps6XX9PiTCeRvhOj+2znBH46/tNosKjLnyfd31j6BNJwgz7nEL+QTNj97AAr oP6RTriSTQ1HI6EtT8uul1po54Oq34ZV04f4l9IoqpIIacvMfC0gZzSuRaNKFX39lUlZ TyX2ZnEJP9Pdx7t9I+PEXpwbjvoSENiGS7/33RQNtcSFwwEraERXUgycIw6eazRoMR4a 6Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3r4187g3tk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Jun 2023 11:28:15 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2B76D10003B; Fri, 9 Jun 2023 11:28:15 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 23D11210F8B; Fri, 9 Jun 2023 11:28:15 +0200 (CEST) Received: from localhost (10.252.12.6) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 9 Jun 2023 11:28:14 +0200 From: Amelie Delaunay To: Lee Jones , Maxime Coquelin , Alexandre Torgue , Liam Girdwood , Mark Brown , Amelie Delaunay CC: Amelie Delaunay , , , Subject: [RESEND PATCH 2/2] mfd: stmfx: Nullify stmfx->vdd in case of error Date: Fri, 9 Jun 2023 11:28:04 +0200 Message-ID: <20230609092804.793100-2-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230609092804.793100-1-amelie.delaunay@foss.st.com> References: <20230609092804.793100-1-amelie.delaunay@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.252.12.6] X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-09_06,2023-06-08_01,2023-05-22_02 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1768219125076229322?= X-GMAIL-MSGID: =?utf-8?q?1768219125076229322?= Nullify stmfx->vdd in case devm_regulator_get_optional() returns an error. And simplify code by returning an error only if return code is not -ENODEV, which means there is no vdd regulator and it is not an issue. Fixes: d75846ed08e6 ("mfd: stmfx: Fix dev_err_probe() call in stmfx_chip_init()") Signed-off-by: Amelie Delaunay --- drivers/mfd/stmfx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c index 54cc902cb578..c02cbd9c2f5d 100644 --- a/drivers/mfd/stmfx.c +++ b/drivers/mfd/stmfx.c @@ -330,9 +330,8 @@ static int stmfx_chip_init(struct i2c_client *client) stmfx->vdd = devm_regulator_get_optional(&client->dev, "vdd"); ret = PTR_ERR_OR_ZERO(stmfx->vdd); if (ret) { - if (ret == -ENODEV) - stmfx->vdd = NULL; - else + stmfx->vdd = NULL; + if (ret != -ENODEV) return dev_err_probe(&client->dev, ret, "Failed to get VDD regulator\n"); }