From patchwork Tue Aug 11 02:33:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 52279 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 812A12152A for ; Tue, 11 Aug 2015 02:33:59 +0000 (UTC) Received: by labd1 with SMTP id d1sf23397860lab.0 for ; Mon, 10 Aug 2015 19:33:58 -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=1l4/aQrWbfPZFJ9jqqCDfg+qNxOFDPkTkimE4bx4MbI=; b=fbzxPbI+y+WMfF7jEatUaHonzPUppFvJllHb4tYVWASDElI0gGHVVsiERvycNDL8Fz 5nvdNN3z9sW/pkk3s4J66sl4QjePPYyhE0PFJ3uK3b+D7Oa/xEPCI3FphzLQp6sn6P+Q MfpEr9bnPTkq9N18w9jmMSa9ESBqJdhhRo10LafzyVUaygwHkxnG4WjKq20Ij74GjUCV j05ZTN5905lUIP1fSgYQp7sGRGMO0EG+oBMLPcY43PuYRUOZIKGtGqlQAsB4HDtM2tVV h/woUUlHWxv2IkVwnKAsqw6J7uA2/ba+RAeDYnxwlA026ojAesXZ8iXv5EIJ1+rmxwtJ 2x7g== X-Gm-Message-State: ALoCoQlKMaKmbSdhEM9U7r0dOnhBCy7kFA/q37SUb5QyVkVl9ZQMYIassgm4Cs4jB9WIZ5rZ81yu X-Received: by 10.194.184.6 with SMTP id eq6mr7248343wjc.4.1439260438271; Mon, 10 Aug 2015 19:33:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.38 with SMTP id lt6ls783640lac.50.gmail; Mon, 10 Aug 2015 19:33:58 -0700 (PDT) X-Received: by 10.152.23.4 with SMTP id i4mr23892962laf.51.1439260438105; Mon, 10 Aug 2015 19:33:58 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id dh9si202817lac.35.2015.08.10.19.33.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 19:33:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labd1 with SMTP id d1so49872811lab.1 for ; Mon, 10 Aug 2015 19:33:58 -0700 (PDT) X-Received: by 10.112.166.106 with SMTP id zf10mr23617212lbb.36.1439260437799; Mon, 10 Aug 2015 19:33:57 -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 l6csp2246209lba; Mon, 10 Aug 2015 19:33:56 -0700 (PDT) X-Received: by 10.66.249.101 with SMTP id yt5mr51312251pac.116.1439260436504; Mon, 10 Aug 2015 19:33:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id re15si593855pab.24.2015.08.10.19.33.55; Mon, 10 Aug 2015 19:33:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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 S933446AbbHKCdy (ORCPT + 12 others); Mon, 10 Aug 2015 22:33:54 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:32809 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933326AbbHKCdx (ORCPT ); Mon, 10 Aug 2015 22:33:53 -0400 Received: by pabyb7 with SMTP id yb7so119015326pab.0 for ; Mon, 10 Aug 2015 19:33:53 -0700 (PDT) X-Received: by 10.66.220.5 with SMTP id ps5mr51997294pac.157.1439260433272; Mon, 10 Aug 2015 19:33:53 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id uv5sm423134pbc.12.2015.08.10.19.33.52 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 10 Aug 2015 19:33:52 -0700 (PDT) Date: Tue, 11 Aug 2015 08:03:49 +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: <20150811023349.GM5766@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-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.215.43 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: > I am not insisting anything. But another patch to get rid of the > goto sounds fine. The separate patch to kill goto. ---------------------8<------------------------- Message-Id: <9f9b9ea6ea3685d5f71c132e7efb18917253961f.1439260355.git.viresh.kumar@linaro.org> From: Viresh Kumar Date: Tue, 11 Aug 2015 08:01:01 +0530 Subject: [PATCH] PM / OPP: Remove unnecessary goto statements The code simply returns after jumping to the out label and doesn't free any resources, etc. Kill the unnecessary goto statements. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index f42e098b71fe..220e8d77e2c4 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -1269,14 +1269,14 @@ static int _of_init_opp_table_v2(struct device *dev, { struct device_node *np; struct device_opp *dev_opp; - int ret = 0, count = 0; + int ret, count = 0; dev_opp = _managed_opp(opp_np); if (dev_opp) { /* OPPs are already managed */ if (!_add_list_dev(dev, dev_opp)) - ret = -ENOMEM; - goto out; + return -ENOMEM; + return 0; } /* We have opp-list node now, iterate over it and add OPPs */ @@ -1287,31 +1287,24 @@ static int _of_init_opp_table_v2(struct device *dev, if (ret) { dev_err(dev, "%s: Failed to add OPP, %d\n", __func__, ret); - break; + of_free_opp_table(dev); + return ret; } } /* There should be one of more OPP defined */ if (WARN_ON(!count)) - goto out; - - if (ret) { - of_free_opp_table(dev); - goto out; - } + return -ENOENT; dev_opp = _find_device_opp(dev); - if (WARN_ON(!dev_opp)) { - ret = -EINVAL; - goto out; - } + if (WARN_ON(!dev_opp)) + return -EINVAL; dev_opp->np = opp_np; dev_opp->shared_opp = of_property_read_bool(opp_np, "opp-shared"); -out: - return ret; + return 0; } /* Initializes OPP tables based on old-deprecated bindings */