From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933761AbbHKG5r (ORCPT ); Tue, 11 Aug 2015 02:57:47 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:32816 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933723AbbHKG5p (ORCPT ); Tue, 11 Aug 2015 02:57:45 -0400 Date: Tue, 11 Aug 2015 12:27:38 +0530 From: Viresh Kumar To: Stephen Boyd Cc: Rafael Wysocki , nm@ti.com, linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, khilman@linaro.org, Greg Kroah-Hartman , Len Brown , open list , Pavel Machek Subject: Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2() Message-ID: <20150811065738.GE5147@linux> References: <804c420eb23e70448c3c2c93f867a0eab3536bfd.1439187821.git.viresh.kumar@linaro.org> <20150810192336.GC9678@codeaurora.org> <20150811002342.GD5766@linux> <55C9425B.4060207@codeaurora.org> <20150811022546.GL5766@linux> <20150811060855.GH9678@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150811060855.GH9678@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10-08-15, 23:08, Stephen Boyd wrote: > On 08/11, Viresh Kumar wrote: > > On 10-08-15, 17:31, Stephen Boyd wrote: > > > So ret is 0. I thought it was an error path, but I guess this is a > > > warning path and we return 0 still? > > > > Urg .. > > Oh I see this is an existing problem... Same problem goes for the > count check. It may be better to fix those two cases first and > then do this cleanup. But I don't mind either way. -------------------------8<------------------------- Message-Id: From: Viresh Kumar Date: Tue, 11 Aug 2015 12:22:07 +0530 Subject: [PATCH] PM / OPP: Return proper errors on failure We are returning 0 by mistake, fix it. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 1daaa1a418a2..be3356a3a452 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -1292,14 +1292,18 @@ static int _of_init_opp_table_v2(struct device *dev, } /* There should be one of more OPP defined */ - if (WARN_ON(!count)) + if (WARN_ON(!count)) { + ret = -ENOENT; goto out; + } if (!ret) { if (!dev_opp) { dev_opp = _find_device_opp(dev); - if (WARN_ON(!dev_opp)) + if (WARN_ON(!dev_opp)) { + ret = -ENOENT; goto out; + } } dev_opp->np = opp_np;