Re: [PATCH] macintosh: macio_asic: fix resource_size.cocci warnings

From: Uwe Kleine-König
Date: Mon Apr 25 2022 - 13:25:23 EST


Hello Michael,

On Fri, Apr 22, 2022 at 04:44:24PM +1000, Michael Ellerman wrote:
> Yihao Han <hanyihao@xxxxxxxx> writes:
> > - if (index == 0 && (res->end - res->start) > 0xfff)
> > + if (index == 0 && (resource_size(res)) > 0xfff)
> > res->end = res->start + 0xfff;
> > - if (index == 1 && (res->end - res->start) > 0xff)
> > + if (index == 1 && (resource_size(res)) > 0xff)
>
> Are you sure the conversion is correct? It's not exactly equivalent:
>
> static inline resource_size_t resource_size(const struct resource *res)
> {
> return res->end - res->start + 1;
> }

Indeed. I pointed out this issue in the v2 that already hit my inbox.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature