Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp896801pxt; Fri, 6 Aug 2021 17:19:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQtB8GU1aJGSoQE6DVgTx9DzfNNwckU84c2owyf5ZRlbEZ9kn6quhhXoIRwvtURR1JizLr X-Received: by 2002:a05:6638:f0e:: with SMTP id h14mr11008882jas.124.1628295567467; Fri, 06 Aug 2021 17:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628295567; cv=none; d=google.com; s=arc-20160816; b=DBT+fRkcdYDOGnOEY1xOnA2Yugxzjtah78noRUeKepa3zfe4U0n3KWmJD+455OPgDK zkVt1B2+lNyEQYgyyNj15PRV3yAP2dxifbyrtHRfrUQJ6U9WnatEI/petnyi8NAKoA+N 16PWHpSnT9Wnf7X64GupRhioIiX4eaWXsyYUJTyHwQOIXZYIw9BHzq9Tx8n2LfSeUfcY Ft3wnOOkFaaEEf6sAQdoym5DSoYs74oM4Y0yj68k5yZtUwMBFdSg/0fS1ngHCFgBRdoO IQvUB5XOY/CTxCMYHVZGpam0qHkERzbXTgGxMZY+5jML/ftt6gKhqzvgECVWHoQfXnfS MjgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/hO8csbgQF4rZNSpEwg088mTQytEwgofytPbc/pXaSk=; b=RAyFXyhqXpbq48a8LmHVIBlKCwlzNRl0h01ZSnoF3xGVGpbkcynAn2J8xKPFIfn7O0 CUD3xtZatQNJ2oIbjlz9jrSw4ut4FCS+l6bABVzCAgr46ErAY/X2VdiZITQSV9b37aV1 GleNbwJv6BqvmRWnxQqnqemYVrlVv34U+xyEU41zyOHNLNr9CuG0KKuSeWoppoB7dfQn dJgCV61/TMYisFNqS+yje8zdhtmxcxnzO66ofd2zyMhvy9U498gdtGBl2Aex5jlddDbl B1egQjDOKFxS8kdH5GB5foB6H3OiBj0xWWHMnDdeUCaU7P0atZm8uqcQqL0GtnEcMrzU f8qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dtkl0YpB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w17si9831376ioc.46.2021.08.06.17.19.15; Fri, 06 Aug 2021 17:19:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dtkl0YpB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245305AbhHFVrc (ORCPT + 99 others); Fri, 6 Aug 2021 17:47:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:43200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241587AbhHFVrc (ORCPT ); Fri, 6 Aug 2021 17:47:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8379610FD; Fri, 6 Aug 2021 21:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628286436; bh=eHdgp7qlzGkw1EVFauYqPH7BFtLqWWFTuQSQQ6Xf048=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Dtkl0YpBpRhQ3FjBoHFGKcLd0r8S4RXgQMZ4NBwkjKP0qozw13+F351ZycLNAU4lb sCf5OFwf43/Nn09phsWheA6ek9BhMCrfe3hZvKC9CUCN3Ijm5NJ5lOqad5LxiPijYJ HyZNlfSiWMDVC5wYGekaD54v0O8fXGIQntQnLzZSeBUpBfB6FiaarO+pm6MNGtP3WY c7/+UbZG9Ytpoe7Y+QwzY99b1lnsx88gSIBuX6ZXJZzAHDUto6syT5sKIPirIUyQ5E HgakvUbgoUlm1YXLBKPxRQrVzcfx1KQLZZiUweNC+JJp8k9wADP9Fy8BOEzUtalKLf Jr0FwDdI98wbg== Received: by earth.universe (Postfix, from userid 1000) id D2CD53C0C99; Fri, 6 Aug 2021 23:47:13 +0200 (CEST) Date: Fri, 6 Aug 2021 23:47:13 +0200 From: Sebastian Reichel To: Tang Bin Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shengju Subject: Re: [PATCH] power: supply: cpcap-battery: Use IS_ERR() to check and simplify code Message-ID: <20210806214713.p7ygp2iux6wjxk5n@earth.universe> References: <20210720061836.29148-1-tangbin@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ax6wwmzhmgmytfow" Content-Disposition: inline In-Reply-To: <20210720061836.29148-1-tangbin@cmss.chinamobile.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ax6wwmzhmgmytfow Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Jul 20, 2021 at 02:18:36PM +0800, Tang Bin wrote: > Use IS_ERR() and PTR_ERR() instead of PTR_ERR_OR_ZERO() to > simplify code, avoid redundant judgements. >=20 > Signed-off-by: Zhang Shengju > Signed-off-by: Tang Bin > --- I think the original variant is the simpler one. Also compiler should be able to optimize this. -- Sebastian > drivers/power/supply/cpcap-battery.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/= cpcap-battery.c > index 90eba3646..7007e5d53 100644 > --- a/drivers/power/supply/cpcap-battery.c > +++ b/drivers/power/supply/cpcap-battery.c > @@ -912,10 +912,9 @@ static int cpcap_battery_probe(struct platform_devic= e *pdev) > =20 > ddata->psy =3D devm_power_supply_register(ddata->dev, psy_desc, > &psy_cfg); > - error =3D PTR_ERR_OR_ZERO(ddata->psy); > - if (error) { > + if (IS_ERR(ddata->psy)) { > dev_err(ddata->dev, "failed to register power supply\n"); > - return error; > + return PTR_ERR(ddata->psy); > } > =20 > atomic_set(&ddata->active, 1); > --=20 > 2.20.1.windows.1 >=20 >=20 >=20 --ax6wwmzhmgmytfow Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmENreEACgkQ2O7X88g7 +pp1QA/+KnBEXpwJMSs5kpz38wuxzFoBm/lCJzDq0AjouV7Jhgznpj09iYOZBDRR YCw5FCllWMIRBEDmX8Qr7OKfgiMkpm5P5J7Lqd8IbpWQy0W5Ym/gm+pLeTdQ5qN/ lXbcPl0dRPRFymNvWUdPzVs6FjLR02G+c1segXKPfxzZTVXr6kN10j28PVZNGvvr Pl6Mt1nVbhJE1tS42vtQoW2jiQ7Y11nTRyUX39X6FBvmeUrv/FlrnJ76wQXElJCA KmsKVfyqur/rwUgzI1dhk9jyJ9+0fVsgflIAbm9bZFhzeGBRDnse5hHQd6nkjiSl rG4CktPPwJ0dG3wJyL4Z71YxDXmOxfu5X4tD7GrO11p4oAA7qlFmzLe1K1NEevmZ SZScT8hiRGKcOh/WOugYQHNg9EWAI7XH48nZ2w3WksTwWo/bVXJiT0fa1rLDhWfK zjrDrCq9BiSylc7swra3AVx3S07dMqsYlOR1ezTbCOqx40m5HJiXCvREJIwSZj7+ 7/VK5GNG7gjZRp9fFOAquy7Vfad6/McrTJUGLrMEJwiHAPSbGG4nWnqwl0THQ+m1 nJTjBcvSybDUpnjcbhpcF1WIF3eXzPRG2elwq5vpEjxH8b3medD5HOY5DHzyNLfN CRpTZgp+fnGDHOaU3ZNm9F+opAPhWoCAqTRdiZ4or8lA3Q7iARA= =BOVH -----END PGP SIGNATURE----- --ax6wwmzhmgmytfow--