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: 13273558 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D18AC7EE29 for ; Fri, 9 Jun 2023 09:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9hVtcrNg2lC9+ogddVZtVyz6A8Jc5ZYsOswKnSxEcrY=; b=REoeDVwFXiCVSA tRu+m0t8m+udd++AOvcPdaWpBVudb43tEIibqUyJG4RiX25KFXEaSMDVj40rPldoQqgXIeMGZTwff cfQW1JCPx8mKr5LhKUI2svgln1Gwq4+lrgcxBSxyV2GP1o0l69tsyHlBp/HNLHebE2io5M+bqpXHq RhXscRx2SrGOtDcDeYOqtTHzLP4lqzUSvUCAUMSrJbHrJUdbjY8ijONc4MexIYFfLYe/42RgIu88/ 3rvLpkmjRiHl+m0wsK+A0Ows3eyrq0RqJuImtHgS7WtNxS7HHA6yX53oMX0AKRjctCsXO68+90UT+ /GyuXvvYrLwkGh3UJE1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7YQ1-00CPXh-0x; Fri, 09 Jun 2023 09:28:29 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7YPu-00CPVT-1w for linux-arm-kernel@lists.infradead.org; Fri, 09 Jun 2023 09:28:24 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_022822_933310_BA615A56 X-CRM114-Status: GOOD ( 17.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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"); }