Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp756789imm; Fri, 13 Jul 2018 05:58:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpesuKax6QeLBf3iAMeqhUPeDL8L9dQmNMzsNxymwmigHR9GTeVF2zV3hd2v0FUb2u1ErxD/ X-Received: by 2002:a65:6109:: with SMTP id z9-v6mr6032005pgu.243.1531486702125; Fri, 13 Jul 2018 05:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531486702; cv=none; d=google.com; s=arc-20160816; b=C4teoL2ighbuVimdprd1PnwMdfYpynI1AkMt3v3I5Ieo1j0bhhdG4b2Qm13Z0pEIhh F5eHbLHlO0k9wIX2DETsbo59c6xC9OGxOOZrMcU26PHkkwmucOuLNjQxcy4ZwQE5D5OU 8e6k+HK8yMTex28YLptI9Ki4a3hse8Y5GkQGJD4vxb4M3XU+5vunYRZbz6PsIMM2RbQf DkYGUIpj+RXYhhXgWuu9s/vcAxqpI5V8NA/Besp9IAIQUkV7yS7c1TDy2iAmz+WBjzwW bqXaTsPm0x8eGno4Uci0BblKdwVSSkbV6IhbcM/Hnfo6VeRA9GVgLDZCZaPdGpa+Sx/4 wG2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=C5+CN+UYum3FqCizoVwPdZz0QmRBDfpEMJ/KTpN/slk=; b=uPICENtueonA29hbfExaVLKVTA8XXyzALXiHVgc20KwAjqUhkv3BQFPiRV6v+Y04KG Qahvqz2Ur26paMI3V/EhorFAy6oqn7l1pBaj2vvhV3usmE2mfizbCmCNUVMXxsma/nII t+vUIT9tVy5Imj8Povf7pWJw/assb5LpWOkFOPh/ASkbrC10VkcBIxVLazSV/RZ0jv5U 3mU01qiAgSSRZdwnUiu0BwTW6JdWlgl6px49NyCbPy78y9lcHZg2iHMBfF0/vux74WnF fhgLUMiGwT78h9kDoJLzjYFCTo9aNbn1aYmLW6BO+z0JV+qwqw4/IEPXov+wKTZu0wAi ZYRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23-v6si23740984pge.589.2018.07.13.05.58.07; Fri, 13 Jul 2018 05:58:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729786AbeGMNLP (ORCPT + 99 others); Fri, 13 Jul 2018 09:11:15 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:48599 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729617AbeGMNLP (ORCPT ); Fri, 13 Jul 2018 09:11:15 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdxck-0004cR-5Q; Fri, 13 Jul 2018 14:56:38 +0200 Received: from mfe by dude.hi.pengutronix.de with local (Exim 4.91) (envelope-from ) id 1fdxch-0003c1-Av; Fri, 13 Jul 2018 14:56:35 +0200 From: Marco Felsch To: lgirdwood@gmail.com, broonie@kernel.org Cc: m.purski@samsung.com, p.paillet@st.com, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH] regulator: core: fix _regulator_do_disable return value Date: Fri, 13 Jul 2018 14:56:24 +0200 Message-Id: <20180713125624.13783-1-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.18.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently _regulator_do_disable returns 0 if either the ena_pin nor the ops.disbale() isn't present. This assumes that the call was successful but it wasn't because disbaling isn't supported at all. The last case of the if-chain should return -EINVAL, because disabling isn't supported by the driver as it is done already by _regulator_do_enable. Signed-off-by: Marco Felsch --- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index bb1324f93143..69b4e096b632 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2311,6 +2311,8 @@ static int _regulator_do_disable(struct regulator_dev *rdev) ret = rdev->desc->ops->disable(rdev); if (ret != 0) return ret; + } else { + return -EINVAL; } /* cares about last_off_jiffy only if off_on_delay is required by -- 2.18.0