Message ID | 8de3aaf297931d655b9ad6aed548f4de8b85425a.1686998575.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1912195vqr; Sat, 17 Jun 2023 04:13:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ouockqGhKnYCQHyWgIt6iQ4sDhqyDQ63OIZcylYg6tvLA72Tl32Pgx9AxTL0LbjPGtROb X-Received: by 2002:a05:6870:8805:b0:1a3:5de8:e78b with SMTP id n5-20020a056870880500b001a35de8e78bmr1773192oam.21.1687000380344; Sat, 17 Jun 2023 04:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687000380; cv=none; d=google.com; s=arc-20160816; b=hetYuIW9z9CQlL+lHkkFSNszCqy+e5D+k51xwSi/W1JYvYoFf2IFCcKlXTJKxjR/Xk sBGOsMyE+UwMVmm8kg/PN5mFpUeTyz/jOa67YqinVXjo7a7JIjyzLq9mMkhB2WtnVERp Yp9XidSIdbjxhjGckr8Cdv5dzDY88vaj8rJ2NTscgpZWqjg1Ve7jKWYG2Qi/16LeTcoR GMjD0VGXug8s8ISdjDDff+t1DibcF9b6uMU0ymFXegaNTThMyZBv96i5I58baSyUQ9bP 7KgFKC/7Nzh8UE3yyUROeenQe96iFmoIsKdPjk5+iwzKsQyp+VrSR6vV3ZMR1u2VJa0b ehrg== 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=dKDAfxkXlHVsJUzF+jDhXkw3h2hy4fQcOsDAMiH6vY4=; b=LXuujt0ZOyszQ8ZmBRXGRhirKCrYzDQpGd4rx+j5x4kns3KezxFHcOTax845hOOXn7 caihM/QMMO0VK78tjOZLY/FM4P7beSQIlmVHmokgXrOaKWHU7gIkTOMXtRBlveK9B/75 gsga8+pnj3tHYNhwaIm8hrnC0m+/zi15PuiUnR/G/bU6hzze4KUuGvk1LHL1GeVAyZgl 7FY1d3otTeB3PuuK8I3GM1ofYdTz96+7T36Gt2dOwv3cvw5cpEhUQHB0Z2UTsF+Kw3WS zThQ508eyBRjJS0PZZq0+cOZbza0cCcPWfRAbA3js49Ml8a0CQ6YAmYB9ONAfgrgL55c 0AFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="N/+2G7ro"; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 127-20020a630085000000b005539d3ab914si180094pga.694.2023.06.17.04.12.27; Sat, 17 Jun 2023 04:13:00 -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=@wanadoo.fr header.s=t20230301 header.b="N/+2G7ro"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234374AbjFQKpF (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Sat, 17 Jun 2023 06:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235296AbjFQKnZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 17 Jun 2023 06:43:25 -0400 Received: from smtp.smtpout.orange.fr (smtp-21.smtpout.orange.fr [80.12.242.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CE0A123 for <linux-kernel@vger.kernel.org>; Sat, 17 Jun 2023 03:43:23 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id ATOnqRvYtW2GfATOnqWHgB; Sat, 17 Jun 2023 12:43:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686998601; bh=dKDAfxkXlHVsJUzF+jDhXkw3h2hy4fQcOsDAMiH6vY4=; h=From:To:Cc:Subject:Date; b=N/+2G7ro0cOieiYfSGRu4oOD4rzio+1S+cwLFwFObllOAg8gR9n3DI6lSql7Ys5yO bDXtmMNOuAnwGZLvBScxHFBcFKktnUhVoBqWBMyyVJ43QAWohlcMcEuz0E1nS7ajAI rbtw+vf3nqzq9Y8YAOTzCF3kFZlKtIASBcXAyNQEGtNysmwhHZcz8KyrfX8NbrOvmg /f0GsPsJPxW7DygrYPTAyZ+399BQdlioSgCEMqvAaZIBQB783lHDJaOrLgEHc4D8WA nygElOWOyjkpM5Mi6QzVPrRra6cZ2iSmDm95azheQieqVvlXHGqh0Uqyu1F4VsTEwj X5oa76s2Az5YA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 17 Jun 2023 12:43:21 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Lee Jones <lee@kernel.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Linus Walleij <linus.walleij@linaro.org> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH] mfd: stmpe: Fix a corner case in stmpe_probe() Date: Sat, 17 Jun 2023 12:43:16 +0200 Message-Id: <8de3aaf297931d655b9ad6aed548f4de8b85425a.1686998575.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768948110582952888?= X-GMAIL-MSGID: =?utf-8?q?1768948110582952888?= |
Series |
mfd: stmpe: Fix a corner case in stmpe_probe()
|
|
Commit Message
Christophe JAILLET
June 17, 2023, 10:43 a.m. UTC
In stmpe_probe(), if some regulator_enable() calls fail, probing continues
and there is only a dev_warn().
So, if stmpe_probe() is called the regulator may not be enabled. It is
cleaner to test it before calling regulator_disable() in the remove
function.
Fixes: 9c9e321455fb ("mfd: stmpe: add optional regulators")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/mfd/stmpe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Sat, Jun 17, 2023 at 12:43 PM Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > In stmpe_probe(), if some regulator_enable() calls fail, probing continues > and there is only a dev_warn(). > > So, if stmpe_probe() is called the regulator may not be enabled. It is > cleaner to test it before calling regulator_disable() in the remove > function. > > Fixes: 9c9e321455fb ("mfd: stmpe: add optional regulators") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Looks correct! Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Sat, 17 Jun 2023, Christophe JAILLET wrote: > In stmpe_probe(), if some regulator_enable() calls fail, probing continues > and there is only a dev_warn(). > > So, if stmpe_probe() is called the regulator may not be enabled. It is > cleaner to test it before calling regulator_disable() in the remove > function. > > Fixes: 9c9e321455fb ("mfd: stmpe: add optional regulators") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > drivers/mfd/stmpe.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Applied, thanks
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index a92301dfc712..9c3cf58457a7 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1485,9 +1485,9 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum) void stmpe_remove(struct stmpe *stmpe) { - if (!IS_ERR(stmpe->vio)) + if (!IS_ERR(stmpe->vio) && regulator_is_enabled(stmpe->vio)) regulator_disable(stmpe->vio); - if (!IS_ERR(stmpe->vcc)) + if (!IS_ERR(stmpe->vcc) && regulator_is_enabled(stmpe->vcc)) regulator_disable(stmpe->vcc); __stmpe_disable(stmpe, STMPE_BLOCK_ADC);