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: 13208771 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 A4753C77B6E for ; Wed, 12 Apr 2023 10:57:02 +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=uVxG9G5iqjqgno r7NjnXD8ibckgt9GQUfHoSAyvRc9jQ545SZNuTmmHKzUNHaQ1UjZYLTfzI3jj2knJPKX80K86AIun SXNgeCBtbkYAXvdrTBCG7+CbLgF3f/cHBMrnJPBCWwhnQDOL7Bfw2WooaIHxErRFKQqv9zysRLj3W ve5/F813KnPupTFwuKcgIqiBxexJsgGBH3XSWUKxCl8qGQzTc+v33FOzVimekZnIgk7UOvJwolMZL wb3B3aS8u3i3wNuI2QaVAqfGWthsKz9WpoPuNWKeehk3NeCiAocFIMxz7kSDX0gRWecrbUgGW/oj2 5FJCsfyJm2KFLu1yzQbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmY99-002iZz-34; Wed, 12 Apr 2023 10:56: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 1pmY8z-002iXG-1f for linux-arm-kernel@lists.infradead.org; Wed, 12 Apr 2023 10:56:09 +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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230412_035605_863119_ADAE1BB5 X-CRM114-Status: GOOD ( 17.42 ) 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"); }