From patchwork Thu Sep 4 12:01:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 36698 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B6134202E4 for ; Thu, 4 Sep 2014 12:04:08 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id 9sf31007635ykp.7 for ; Thu, 04 Sep 2014 05:04:08 -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=HaFvB3604CMg4ZVBIPCYt5eItf5u9e9ZH2CjEkUJlCo=; b=Vt4A2V4lc38tbNiLlsIJzr3DTAMZWYdMKevBM1qAM7vavnl6DcwygxrSirNGbOHd46 smjTca4DkYhA6khswyl5cuCFRAbxfVXTSJJrgIdUnJPkxtYPXVxgG+Ih8AJU8iXx9YTn w3NSOvRtZTZFF2vJBt58UfQ3oX+3wblxy8s7nq7ug7UpBpuznMTjKrP4cNk4uUXsdVMe 9eF9NOFUrxMH4o3+BetS7jl8JneL23w79Py1KmpGsh1kwSIZVcf4IU35COMPusTPcJZG d7e6jn7MR1tsj/FJHWHfl7+kkqBsmCXx3EdDHYR6+NHcrDFzLMojdQiM1RzvbYHPLeHe GCIg== X-Gm-Message-State: ALoCoQmuJ7xqNIO+xPjcAkEpWOPj09SVOs1M6DvFRUD/Sj3AO2icCso9J/QJfaq7fx0wuCRsQ1b6 X-Received: by 10.236.87.46 with SMTP id x34mr1986593yhe.49.1409832248474; Thu, 04 Sep 2014 05:04:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.210 with SMTP id u76ls261375qge.62.gmail; Thu, 04 Sep 2014 05:04:08 -0700 (PDT) X-Received: by 10.52.120.51 with SMTP id kz19mr301924vdb.95.1409832248365; Thu, 04 Sep 2014 05:04:08 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id ct1si2703319vdc.80.2014.09.04.05.04.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:04:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so10434037vcb.15 for ; Thu, 04 Sep 2014 05:04:08 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr3202140vcn.16.1409832248207; Thu, 04 Sep 2014 05:04:08 -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 uj3csp824516vcb; Thu, 4 Sep 2014 05:04:07 -0700 (PDT) X-Received: by 10.66.182.227 with SMTP id eh3mr8196017pac.68.1409832217376; Thu, 04 Sep 2014 05:03:37 -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.03.32 for ; Thu, 04 Sep 2014 05:03:32 -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 S1753999AbaIDMDI (ORCPT + 15 others); Thu, 4 Sep 2014 08:03:08 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:64492 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753774AbaIDMDG (ORCPT ); Thu, 4 Sep 2014 08:03:06 -0400 Received: by mail-pd0-f176.google.com with SMTP id w10so4024074pde.7 for ; Thu, 04 Sep 2014 05:03:04 -0700 (PDT) X-Received: by 10.70.129.204 with SMTP id ny12mr2091896pdb.114.1409832184366; Thu, 04 Sep 2014 05:03:04 -0700 (PDT) Received: from localhost ([122.167.123.172]) by mx.google.com with ESMTPSA id gv11sm1526491pbd.61.2014.09.04.05.03.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Sep 2014 05:03:03 -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 12/15] power-supply: Use PTR_ERR_OR_ZERO() routine Date: Thu, 4 Sep 2014 17:31:33 +0530 Message-Id: <50c6a288bc4a7b767fcdc13bb946454b35ad7e24.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.170 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: , At multiple places we are doing exactly what PTR_ERR_OR_ZERO() does. And so that routine can be reused instead of increasing lines of code here. Signed-off-by: Viresh Kumar --- drivers/power/power_supply_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 26518c8..376464e 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -435,9 +435,7 @@ static int psy_register_thermal(struct power_supply *psy) if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { psy->tzd = thermal_zone_device_register(psy->name, 0, 0, psy, &psy_tzd_ops, NULL, 0, 0); - if (IS_ERR(psy->tzd)) - return PTR_ERR(psy->tzd); - break; + return PTR_ERR_OR_ZERO(psy->tzd); } } return 0; @@ -515,9 +513,7 @@ static int psy_register_cooler(struct power_supply *psy) psy->tcd = thermal_cooling_device_register( (char *)psy->name, psy, &psy_tcd_ops); - if (IS_ERR(psy->tcd)) - return PTR_ERR(psy->tcd); - break; + return PTR_ERR_OR_ZERO(psy->tcd); } } return 0;