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: 6987751 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B1DFAC05AC for ; Tue, 11 Aug 2015 02:33:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 82DD5205BC for ; Tue, 11 Aug 2015 02:33:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77B18205B8 for ; Tue, 11 Aug 2015 02:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933446AbbHKCdy (ORCPT ); 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=gzimO5RtuE1NpsOxS9oKoAgGlQXtSntbuhDtPBUZ5WM=; b=dIfLUT6RafklSIV4bYvKxC+ShqOBSDyn83f8d3a1SiYzP5BHKIt2+Ub1bAcGlui8E8 DZn1R/oPTHxwDoBddRFdxZHBwQ4427LVD4nLBNoi4MltJl8ZLA16FDLU0kUaZpkvGtuX WOCQ5yLXSqSsN+dQ8UwwHeAFhd6/UiCqy0ZS4vJYg0EcQ5+eByUXg6iisEzk4d+Kuq7J S92tblNF7JfvsJyuL3V4/s26ddmVIqBtgKcdFjbkm5ehpDWgmc8z6qUNMPhwjNtNnmyd AUzyuOI7g0mAjEJr1/9xnPbxU4nunYbhyGgvswERrs2NG6XCMkZr5DTsChYuXbaU2E4V 7ERQ== X-Gm-Message-State: ALoCoQlikklFsz2CtPZo9jnH2gqwntsrYccCadnPo4HKdmCXal5jTRW9nKUPHjrpTS+SDhLmTUV8 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: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Stephen Boyd --- 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 */