From patchwork Tue Aug 11 02:25:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 52278 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 738C82152A for ; Tue, 11 Aug 2015 02:25:58 +0000 (UTC) Received: by labia3 with SMTP id ia3sf45435727lab.1 for ; Mon, 10 Aug 2015 19:25:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=qLT9p9qjwk8JZG41jbjGc1MD9vW/ieAuz2WhyanYR6M=; b=BhLNq7Y09oRV4i422ee+DChr6z5oW3HfWRBQmGL9fflHvfoxuRQHHgbz4lErg0xMGd IbTVMLUY5KI5EUCu91KynTLKJvip5GcuscVEZL050hUq0eNl00OWhmAxMBebzalCcTGY hZMEusgyYoQIatMxf17fQaQqbWMAsEKKiANVTbJER5tbon8Lel48DPxpny3j452w2EZl 2TSAIJGw9B7G8x/AE8xMqLTD+NcOLyMpGwoLod/1Pc6jCn/tcLxak4ZbRYHG4kStUVLV txZZKoFrMc5B3bn+lJABmb5y/9Zcip2yR8H4L6HXYm36rwrOR2jvcgtU5UB9DyO9Ozs6 q7tw== X-Gm-Message-State: ALoCoQlNeWtHEoVCKIlVZo2CnvUydCZLMg+JAH/vLKRi59vpdr1SCzMbaPkq01e4bc6d0rJYFiZp X-Received: by 10.194.179.42 with SMTP id dd10mr7230639wjc.7.1439259957039; Mon, 10 Aug 2015 19:25:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.35 with SMTP id s3ls807705lae.29.gmail; Mon, 10 Aug 2015 19:25:56 -0700 (PDT) X-Received: by 10.112.92.101 with SMTP id cl5mr23156108lbb.67.1439259956713; Mon, 10 Aug 2015 19:25:56 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id z9si184832lbu.81.2015.08.10.19.25.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 19:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbpu9 with SMTP id pu9so77862177lbb.3 for ; Mon, 10 Aug 2015 19:25:56 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr23648796lbc.112.1439259956491; Mon, 10 Aug 2015 19:25:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp2243814lba; Mon, 10 Aug 2015 19:25:55 -0700 (PDT) X-Received: by 10.68.190.10 with SMTP id gm10mr22855712pbc.5.1439259954461; Mon, 10 Aug 2015 19:25:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qc7si519666pdb.74.2015.08.10.19.25.53; Mon, 10 Aug 2015 19:25:54 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933536AbbHKCZw (ORCPT + 28 others); Mon, 10 Aug 2015 22:25:52 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35860 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932670AbbHKCZu (ORCPT ); Mon, 10 Aug 2015 22:25:50 -0400 Received: by pacrr5 with SMTP id rr5so116224900pac.3 for ; Mon, 10 Aug 2015 19:25:50 -0700 (PDT) X-Received: by 10.68.249.36 with SMTP id yr4mr50782040pbc.18.1439259950072; Mon, 10 Aug 2015 19:25:50 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id fv5sm407944pdb.19.2015.08.10.19.25.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Aug 2015 19:25:49 -0700 (PDT) Date: Tue, 11 Aug 2015 07:55:46 +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: <20150811022546.GL5766@linux> References: <804c420eb23e70448c3c2c93f867a0eab3536bfd.1439187821.git.viresh.kumar@linaro.org> <20150810192336.GC9678@codeaurora.org> <20150811002342.GD5766@linux> <55C9425B.4060207@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <55C9425B.4060207@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 .. -------------------------8<------------------------- Message-Id: From: Viresh Kumar Date: Tue, 4 Aug 2015 11:57:36 +0530 Subject: [PATCH] PM / OPP: restructure _of_init_opp_table_v2() 'dev_opp' will always be NULL in _of_init_opp_table_v2() after creating OPPs for a device. There is no point comparing it against NULL there. Restructure code a bit to make it more efficient. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 1daaa1a418a2..f42e098b71fe 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -1295,20 +1295,21 @@ static int _of_init_opp_table_v2(struct device *dev, if (WARN_ON(!count)) goto out; - if (!ret) { - if (!dev_opp) { - dev_opp = _find_device_opp(dev); - if (WARN_ON(!dev_opp)) - goto out; - } - - dev_opp->np = opp_np; - dev_opp->shared_opp = of_property_read_bool(opp_np, - "opp-shared"); - } else { + if (ret) { of_free_opp_table(dev); + goto out; } + dev_opp = _find_device_opp(dev); + if (WARN_ON(!dev_opp)) { + ret = -EINVAL; + goto out; + } + + dev_opp->np = opp_np; + dev_opp->shared_opp = of_property_read_bool(opp_np, + "opp-shared"); + out: return ret; }