From patchwork Thu Sep 4 12:01:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 36694 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A93A4202E4 for ; Thu, 4 Sep 2014 12:02:59 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wn1sf51843986obc.2 for ; Thu, 04 Sep 2014 05:02:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=shX2DqvujIbkZAKvMhYBv7wrbBNZnYRaWAMxmdLQrJ0=; b=Ya1eIJf2sbs3PkowaCOkgNQjjhOMMhynre+PqSwYjDuxVzdYI09m3bj8OiudD25xS9 NlpXRvC6E+KHGbOKr+Cn3v1F9hKU1f7IdSr2/SI4PuUla1OY5DKFY+EviMq4g2OnyJc1 WbhOIGadOtVlVh4+o8vjx9GKOwNMkyHbVsVIOzdi1Orxw4dsasKjkwHBznPCN8B2RqrN pHCxiGp1FcVrLemlfEbhC025YCk5LJ66LO3W0WIOajdlIxuzZPJwo1faejzcuEvIScsw 2nI1xrj4WU8ywdK9XeHKbQ9YPAjpIX8yeL3tljbaz4uBKvLEH1uIZkPxr8YUIj05s1yf by4Q== X-Gm-Message-State: ALoCoQlxrJEhTgZ4JM3Vzpp0CF0rXfd4GJbXOt8dr//8vdM7W4IFrJqYyb5BovBM35dYw6ccQKI/ X-Received: by 10.42.210.17 with SMTP id gi17mr2134960icb.1.1409832179288; Thu, 04 Sep 2014 05:02:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.103.177 with SMTP id y46ls220057qge.79.gmail; Thu, 04 Sep 2014 05:02:59 -0700 (PDT) X-Received: by 10.52.97.233 with SMTP id ed9mr2660535vdb.16.1409832179205; Thu, 04 Sep 2014 05:02:59 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id h4si2739679vdx.8.2014.09.04.05.02.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:02:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so10161323vcb.25 for ; Thu, 04 Sep 2014 05:02:59 -0700 (PDT) X-Received: by 10.220.175.17 with SMTP id v17mr3206257vcz.0.1409832179120; Thu, 04 Sep 2014 05:02:59 -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.221.45.67 with SMTP id uj3csp824312vcb; Thu, 4 Sep 2014 05:02:58 -0700 (PDT) X-Received: by 10.70.96.233 with SMTP id dv9mr8154756pdb.146.1409832178151; Thu, 04 Sep 2014 05:02:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lp3si3076549pab.230.2014.09.04.05.02.53 for ; Thu, 04 Sep 2014 05:02:54 -0700 (PDT) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753893AbaIDMCg (ORCPT + 15 others); Thu, 4 Sep 2014 08:02:36 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:43889 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753774AbaIDMCg (ORCPT ); Thu, 4 Sep 2014 08:02:36 -0400 Received: by mail-pd0-f176.google.com with SMTP id w10so4073623pde.35 for ; Thu, 04 Sep 2014 05:02:35 -0700 (PDT) X-Received: by 10.70.34.136 with SMTP id z8mr8080174pdi.39.1409832155306; Thu, 04 Sep 2014 05:02:35 -0700 (PDT) Received: from localhost ([122.167.123.172]) by mx.google.com with ESMTPSA id ps6sm1527659pbb.56.2014.09.04.05.02.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:02:34 -0700 (PDT) From: Viresh Kumar To: sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org, anton@enomsg.org Cc: linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org, Viresh Kumar Subject: [PATCH 07/15] power-supply: Rearrange code to remove duplicate lines Date: Thu, 4 Sep 2014 17:31:28 +0530 Message-Id: <1d1fa9656ca0763735eee03ea34f4b6f70032406.1409831636.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd In-Reply-To: <2eacd908a8094887cc1796f75ae0513be8a3e36d.1409831636.git.viresh.kumar@linaro.org> References: <2eacd908a8094887cc1796f75ae0513be8a3e36d.1409831636.git.viresh.kumar@linaro.org> In-Reply-To: References: 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.220.180 as permitted sender) smtp.mail=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: , of_node_put() was called twice in power_supply_check_supplies() whereas a single call will also work. Rearrange code a bit to make that feasible. Signed-off-by: Viresh Kumar --- drivers/power/power_supply_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 7657335..8a86cd1 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -218,12 +218,12 @@ static int power_supply_check_supplies(struct power_supply *psy) break; ret = power_supply_find_supply_from_node(np); + of_node_put(np); + if (ret) { dev_dbg(psy->dev, "Failed to find supply, defer!\n"); - of_node_put(np); return -EPROBE_DEFER; } - of_node_put(np); } while (np); /* Missing valid "power-supplies" entries */