From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0731C433F5 for ; Tue, 19 Apr 2022 07:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349662AbiDSH6I (ORCPT ); Tue, 19 Apr 2022 03:58:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349665AbiDSH56 (ORCPT ); Tue, 19 Apr 2022 03:57:58 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 551B717AB0 for ; Tue, 19 Apr 2022 00:55:15 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngihX-0000Zo-Ue; Tue, 19 Apr 2022 09:55:07 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1ngihV-003vZp-II; Tue, 19 Apr 2022 09:55:04 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1ngihT-004Do6-7q; Tue, 19 Apr 2022 09:55:03 +0200 Date: Tue, 19 Apr 2022 09:54:55 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Yihao Han Cc: Benjamin Herrenschmidt , Ulf Hansson , Mark Brown , Srinivas Pandruvada , William Breathitt Gray , Sven Van Asbroeck , Corentin Labbe , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel@vivo.com Subject: Re: [PATCH] macintosh: macio_asic: fix resource_size.cocci warnings Message-ID: <20220419075455.vecnndadzkhd2xiz@pengutronix.de> References: <20220414140304.82751-1-hanyihao@vivo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sxvrzxezae3ma7n3" Content-Disposition: inline In-Reply-To: <20220414140304.82751-1-hanyihao@vivo.com> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --sxvrzxezae3ma7n3 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 14, 2022 at 07:02:42AM -0700, Yihao Han wrote: > drivers/macintosh/macio_asic.c:219:26-29: WARNING: > Suspicious code. resource_size is maybe missing with res > drivers/macintosh/macio_asic.c:221:26-29: WARNING: > Suspicious code. resource_size is maybe missing with res For log messages it's ok to overstep the line length limitation for commit logs. IMHO adding newlines is worse, not sure that there are no other strong opinions though. > Use resource_size function on resource object instead of > explicit computation. >=20 > Generated by: scripts/coccinelle/api/resource_size.cocci >=20 > Signed-off-by: Yihao Han > --- > drivers/macintosh/macio_asic.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asi= c.c > index 1943a007e2d5..260fccb3863e 100644 > --- a/drivers/macintosh/macio_asic.c > +++ b/drivers/macintosh/macio_asic.c > @@ -216,9 +216,9 @@ static int macio_resource_quirks(struct device_node *= np, struct resource *res, > /* Some older IDE resources have bogus sizes */ > if (of_node_name_eq(np, "IDE") || of_node_name_eq(np, "ATA") || > of_node_is_type(np, "ide") || of_node_is_type(np, "ata")) { > - if (index =3D=3D 0 && (res->end - res->start) > 0xfff) > + if (index =3D=3D 0 && (resource_size(res)) > 0xfff) You can drop the parenthesis around resource_size(res) here. Other than that looks fine, Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --sxvrzxezae3ma7n3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmJeaswACgkQwfwUeK3K 7Akmiwf9ENjj+1XyRjZKG6TQJHTh12ZDIDiPKh8kOqIgoTd/QXcYHd8z7bUZckqC 0MEnKvjMjOKM3RO5/rbMVQFth3PKl5XHsn9iD8+Chn2JPG3Z5bx15pXAxig/z20P A9SdzAWpdx17ShxXahVjFiWusA/n6fZ2910e/xtjdzQUM9onzWCSu+8fFLMtCRW7 pnKofCHibLKVxDYxLDmplqJDM3uEXY8xr2hUrx1PiauhQrWxgMk9CKQaGMFYWCCX tNSOro1Tv9SWvMJGQBEsRU8rW3w0YpHBfmfj7gnmf/I8cc+tKTM25u7uOZCbXMBg 2T2Up7pYQ2lw9G1shEku4uBL4lSLRA== =5jxk -----END PGP SIGNATURE----- --sxvrzxezae3ma7n3--