From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752114AbcCUCaA (ORCPT ); Sun, 20 Mar 2016 22:30:00 -0400 Received: from lists.s-osg.org ([54.187.51.154]:55012 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751384AbcCUC37 (ORCPT ); Sun, 20 Mar 2016 22:29:59 -0400 From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , Liam Girdwood , Mark Brown Subject: [PATCH] regulator: Remove unneded check for regulator supply Date: Sun, 20 Mar 2016 23:29:45 -0300 Message-Id: <1458527385-3233-1-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The regulator_resolve_supply() function checks if a supply has been associated with a regulator to avoid enabling it if that is not the case. But the supply was already looked up with regulator_resolve_supply() and set with set_supply() before the check and both return on error. So the fact that this statement has been reached means that neither of them failed and a supply must be associated with the regulator. Signed-off-by: Javier Martinez Canillas --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e0b764284773..6dd63523bcfe 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1532,7 +1532,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) } /* Cascade always-on state to supply */ - if (_regulator_is_enabled(rdev) && rdev->supply) { + if (_regulator_is_enabled(rdev)) { ret = regulator_enable(rdev->supply); if (ret < 0) { _regulator_put(rdev->supply); -- 2.5.0