From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Yihao Han <hanyihao@vivo.com>
Cc: Sven Van Asbroeck <TheSven73@gmail.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
William Breathitt Gray <vilhelm.gray@gmail.com>,
linux-kernel@vger.kernel.org, kernel@vivo.com,
Mark Brown <broonie@kernel.org>,
Corentin Labbe <clabbe@baylibre.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] macintosh: macio_asic: fix resource_size.cocci warnings
Date: Tue, 19 Apr 2022 09:54:55 +0200 [thread overview]
Message-ID: <20220419075455.vecnndadzkhd2xiz@pengutronix.de> (raw)
In-Reply-To: <20220414140304.82751-1-hanyihao@vivo.com>
[-- Attachment #1: Type: text/plain, Size: 1638 bytes --]
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.
>
> Generated by: scripts/coccinelle/api/resource_size.cocci
>
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
> drivers/macintosh/macio_asic.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.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 == 0 && (res->end - res->start) > 0xfff)
> + if (index == 0 && (resource_size(res)) > 0xfff)
You can drop the parenthesis around resource_size(res) here.
Other than that looks fine,
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-04-19 8:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 14:02 [PATCH] macintosh: macio_asic: fix resource_size.cocci warnings Yihao Han
2022-04-19 7:54 ` Uwe Kleine-König [this message]
2022-04-22 6:44 ` Michael Ellerman
2022-04-25 17:23 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220419075455.vecnndadzkhd2xiz@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=TheSven73@gmail.com \
--cc=broonie@kernel.org \
--cc=clabbe@baylibre.com \
--cc=hanyihao@vivo.com \
--cc=kernel@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=ulf.hansson@linaro.org \
--cc=vilhelm.gray@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).