From patchwork Thu Mar 16 16:53:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13178077 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 B998AC6FD19 for ; Thu, 16 Mar 2023 16:55:21 +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=IaXVOWlUp8D8OwVONEIWFHso0fqmIe6uAqHHfiCkKlA=; b=lpwPCnXffCIAVW kA8Xi2D+rMELBU6Y5LzECsQiertrmJ09lBog+P2v4Uw8TAVTExjar784y/6FVNUE0qarck2KTFH6n zjb5fRA37dc9vKw3I98trMP2fdgXnCpsVesCx51OQTF7YHY/dc3al7WPPP78SDYdkYatHVUHT6F2o TZp6rZyZX/FYdkpqcGSgG85p3+oaJl5YEjRwtXyJUtu18U4lcl9LfpTHcg8Mtf0zSEAqTLIvw0HOP rowQHM8oT89SDrvR/E1kdYnr3whm7FmZNsL4OkUeXgvEDynfVe6k55pTfLxzc543OiLsiMCR2qFyA 2IKvggGDU9i9qNsr+pjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcqrn-00H3nH-1h; Thu, 16 Mar 2023 16:54:15 +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 1pcqrh-00H3lV-33 for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2023 16:54:12 +0000 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 32GCLvl0025488; Thu, 16 Mar 2023 17:53:57 +0100 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=jCalCzWEGgluzEpxxwmaELyiEdADSScn2RV6MlJVuNiwYfwne+RJr9Bwuja2e/E34WIX WgjqdD0IUeriFgIG54kLV5DiqK/1KKaI9WHsKMepoZNDpVD4IyfwPHsao89CcBUcWBO3 bhADgaCpKgcbyr6RT/GpQqtxmYZ3keQEMQr6Fl4QvuGmw0viXAekvoM+jnNvMsPyetAy /j1Hs2G7Tar3yOQCzPbMRr5fJPyOC5Rcv6ZCj5VafNocRM9cwVTPk41mVSFzK9BVvOXf bjUh06RuR7yAjyuf93n/8QIai3hN1yGsNoTlPcqTYRNKeBfbBvABNemQ5n1C86wpB55w dQ== 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 3pbpwqwxtq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Mar 2023 17:53:57 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E759710002A; Thu, 16 Mar 2023 17:53:56 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E1F7221ED52; Thu, 16 Mar 2023 17:53:56 +0100 (CET) Received: from localhost (10.201.20.208) 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.17; Thu, 16 Mar 2023 17:53:56 +0100 From: Amelie Delaunay To: Lee Jones , Maxime Coquelin , Alexandre Torgue CC: , , , Amelie Delaunay Subject: [PATCH 2/2] mfd: stmfx: Nullify stmfx->vdd in case of error Date: Thu, 16 Mar 2023 17:53:47 +0100 Message-ID: <20230316165347.2669038-3-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230316165347.2669038-1-amelie.delaunay@foss.st.com> References: <20230316165347.2669038-1-amelie.delaunay@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.208] 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.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-16_10,2023-03-16_01,2023-02-09_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230316_095410_953082_736D2781 X-CRM114-Status: GOOD ( 16.88 ) 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 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"); }