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

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Apr 26 03:23:50 AEST 2022


Hello Michael,

On Fri, Apr 22, 2022 at 04:44:24PM +1000, Michael Ellerman wrote:
> Yihao Han <hanyihao at vivo.com> 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/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20220425/df4275d6/attachment.sig>


More information about the Linuxppc-dev mailing list