From patchwork Wed Apr 12 10:55:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 82382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp234301vqo; Wed, 12 Apr 2023 04:03:50 -0700 (PDT) X-Google-Smtp-Source: AKy350b25OWhDnBbIBsGVtwT+8sij0CX2ItNLWzgVgHz+w8yuxB3fMGQpn9ge9ggSqGRYdwzv7fd X-Received: by 2002:a17:90b:1651:b0:246:91d0:9e6f with SMTP id il17-20020a17090b165100b0024691d09e6fmr15783687pjb.3.1681297430276; Wed, 12 Apr 2023 04:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681297430; cv=none; d=google.com; s=arc-20160816; b=Z0MRFIcLLb03IJN97HiVvddnzGY7e3ZZF4keA/gt46vXqnRbJ54WX13WGNG2TAg6oV 0MNmS0NM9c/Kcj20lPGN3gp+sPnBBWV8TeDzRkT2BMP/ZKI2fLhfyoWUDG5/HMFcisXk zs31tUKXFchVS3VufgTYyShWv/7Bf1lUzHR3AvY747e4M8jgUqW+tLBXTCnkZ8OEulY6 3R26pQfIfV8bFTbWPka4T0TD7omA049/9/ujdoVVJGsUh0beHjoF2Oh3IEHrQOmnccZN FXTIlW8SU1tZLDhxNlNI+2FyEh0IpTkICe5I56yJ3BMRS84Th0BDTceQexJq1+jEfWSL 0MWA== 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=xBkM+wcHkn0+wAwRzFfs1U5GhFDjurk++GN6bVOC3Og=; b=XaxNXy4RX71hMB/k1pNDxk6ZCVdFDBnVh7DAjy5ggEN8hZMNE1mRpKUGDj2MhuLKOM cjTuxYC5qoNR94QE/vKcqQIrgZkTtr2r8ob2DVvuBcY0zCQOr2db5rqtnbt5Wi2YZQ5+ 0ObKGytXoGe4naVaYTWOXGyNqcQWCFgIUOJBjA5GecKor+s4wqK/dIsHNR31xDrkFY/c Ol5AtP5AxuxnPDPFq7tfWue4zz79vCfsH39cvBh81Kt3rdxYXflo3fAlNFCD36x9bmi/ n4rHcbwuLzxanDyKh05tbVYZrmCE+we/neh+H/mheJ8NEmnVAec1T8nPfPrn5nLY/vhh qdLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=hYYb7Puy; 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 a22-20020a17090ad81600b00240a96d8b44si1611660pjv.103.2023.04.12.04.03.37; Wed, 12 Apr 2023 04:03:50 -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=hYYb7Puy; 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 S229882AbjDLK4O (ORCPT + 99 others); Wed, 12 Apr 2023 06:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjDLK4M (ORCPT ); Wed, 12 Apr 2023 06:56:12 -0400 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D89E06A7D for ; Wed, 12 Apr 2023 03:56:09 -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 33C8pegq006573; Wed, 12 Apr 2023 12:55:57 +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=xBkM+wcHkn0+wAwRzFfs1U5GhFDjurk++GN6bVOC3Og=; b=hYYb7Puy4Sd9NST1T9rTluYjt9fkZUkBdjbAMEmsqWe/MDXGCbMfVDuJS4e578xRxD4z ICgTiNV5snAnd0j27ibk4LmwxfIJRKi+2f05ICcT+8ZDOdWYPZLj7SV9v69QZwP6kzeF 1w5wd8CuiIOg+r+SDEstNkcobsyRmC1hz8qDuhSWbtJoYRM7ErFp8F4BAWLGfGdPztv2 /UjEHRk2ZaAE4k+eZp9W8vFKk7vQbbaxSbitUmZJjGrtKHE3NnwcMAoPB3lrIAfRzPZZ VVHbU1qyscEeQrVI7rlTLoY7Go7PAOAs871h/6LBQWJTdv7qKOs+6+boBUoyDVCPX7ta 5w== 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 3pwsgp91ra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Apr 2023 12:55:57 +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 40FC9100034; Wed, 12 Apr 2023 12:55:57 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3AF0D2128D0; Wed, 12 Apr 2023 12:55:57 +0200 (CEST) Received: from localhost (10.252.10.182) 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; Wed, 12 Apr 2023 12:55:57 +0200 From: Amelie Delaunay To: Lee Jones , Maxime Coquelin , Alexandre Torgue CC: , , , Amelie Delaunay Subject: [RESEND PATCH 1/2] mfd: stmfx: Fix error path in stmfx_chip_init Date: Wed, 12 Apr 2023 12:55:41 +0200 Message-ID: <20230412105542.1231131-2-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412105542.1231131-1-amelie.delaunay@foss.st.com> References: <20230412105542.1231131-1-amelie.delaunay@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.252.10.182] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-12_03,2023-04-12_01,2023-02-09_01 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, 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?1762968134121060834?= X-GMAIL-MSGID: =?utf-8?q?1762968134121060834?= 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 e281971ba54e..bfe89df27611 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 Wed Apr 12 10:55:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 82383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp235718vqo; Wed, 12 Apr 2023 04:05:49 -0700 (PDT) X-Google-Smtp-Source: AKy350bK6S5xOcrGRafNnR2TIdgGqNvhCnNnCWYrS+OHo9KYUWT5tKsvjEC3Kyh4LodxG4Wx2eh9 X-Received: by 2002:aa7:cfcd:0:b0:504:9345:ffa4 with SMTP id r13-20020aa7cfcd000000b005049345ffa4mr11209183edy.21.1681297549083; Wed, 12 Apr 2023 04:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681297549; cv=none; d=google.com; s=arc-20160816; b=sQqd3buVSnIZ+f5uWCnbl0Vc5/0sz14jRCZU/axDvS6qyMhAfDmSMqab5TZX4awj+5 QC98NNxQerX2B8nLi8d7jx/ZKjQscHyes6SbemLfpgij62v2ZKQEN+B2+CPWxDsJeT4c AWywBKf8gMRbY9048cUxlBlyChW0ZlF0OEhhNFAxs3+LxvDgQfjq+0ZiVNfu/NmQhNWA k/klXj9yhNjdImAETGnYs1Rgeuo3CPnFHzk24AdFWc3Nj9z+trc7jcAY37ZuHItglQBY qJRheX2z5DYarq3OcYEymwQBOaIopcRh3lmEKkEzsCHYoPX47nABYm1fDMu8qhs40NaN 92sg== 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=A+lMTa0nB7HohOca8aARuO3o3kfnPHCwrPixYCAy+Cc=; b=w9/8I8fCV6qxLXlK14Nt6a3XedZB+AQx0B1K6SImyBU06aX2vCxmM2Ur66FcUMa1Df FMio/3asa2IyKAZV3L4AruTcq2Ql8jDkSKt+22RLfl+Z9ElifbJ/YvJKRNgK9Dy96YGv I9CgsvIhue8VcGyxcJZT5R6dh2JWe2VjZSHgPcI+YjADV2zcBSBBujpYsOCEZTqXjLSM jh7ylK6hHWwo2cB+tQganRngBL6lkFrUH7zsj6IacEs/DVIxj9U1+lzjrNveXwwqv3rd ntOuYcsRxRQMJNuJAAHzZdg8WOeSHBc5p2ryhtTKSIXHEi6X/EQ8Jmp/cx+r4d2wFls7 5x9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=6zNuOrcd; 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 u6-20020a056402064600b005047e09b249si10040812edx.389.2023.04.12.04.05.23; Wed, 12 Apr 2023 04:05:49 -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=6zNuOrcd; 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 S229904AbjDLK4R (ORCPT + 99 others); Wed, 12 Apr 2023 06:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbjDLK4N (ORCPT ); Wed, 12 Apr 2023 06:56:13 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ACB26A69 for ; Wed, 12 Apr 2023 03:56:11 -0700 (PDT) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33C9Ft8P001546; Wed, 12 Apr 2023 12:55:58 +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=A+lMTa0nB7HohOca8aARuO3o3kfnPHCwrPixYCAy+Cc=; b=6zNuOrcdJpp999pZetREP/7mwIM30FfwC/aIbyQzH5FmhijimSA2YIksbLKS8ZwBgaRg iMsxV/FykoB7vhp0XVUc0r5t9wlYzAVALYbZ/MbAUOXGKEGEUvuwjYIoCAx0D41ERtB2 Hhc8nNI0Gc53V/5uKLyH9Q04F5/bajFUBHgHLIdInco3Iz4izzlZTNLjzV0bopJgsrU6 Ixxyw+RLdZivw0jfPILr0UjXPvM7Gjn7hKA+Xx++6h/spyjtRpjJEaYcMmmMf9csmIbr B6kT8FDZcUoZ8oDLa1R9KKHdKR1ho5lMRYHcYP2MzcToB94dORvjuLCNuV/p2sRKh16b wQ== 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 3pw8b0pgrq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Apr 2023 12:55:58 +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 D06A510002A; Wed, 12 Apr 2023 12:55:57 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CA2C92128D0; Wed, 12 Apr 2023 12:55:57 +0200 (CEST) Received: from localhost (10.252.10.182) 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; Wed, 12 Apr 2023 12:55:57 +0200 From: Amelie Delaunay To: Lee Jones , Maxime Coquelin , Alexandre Torgue CC: , , , Amelie Delaunay Subject: [RESEND PATCH 2/2] mfd: stmfx: Nullify stmfx->vdd in case of error Date: Wed, 12 Apr 2023 12:55:42 +0200 Message-ID: <20230412105542.1231131-3-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230412105542.1231131-1-amelie.delaunay@foss.st.com> References: <20230412105542.1231131-1-amelie.delaunay@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.252.10.182] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-12_03,2023-04-12_01,2023-02-09_01 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, 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?1762968258572754300?= X-GMAIL-MSGID: =?utf-8?q?1762968258572754300?= 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 bfe89df27611..76188212c66e 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"); }