Re: [PATCH v2] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL

From: Uwe Kleine-König
Date: Thu Nov 10 2022 - 10:07:38 EST


Hello,

On Mon, Nov 07, 2022 at 07:11:35PM +0100, Uwe Kleine-König wrote:
> devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to
> the shorter devm_platform_ioremap_resource(pdev, index).
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
> On Mon, Nov 07, 2022 at 08:45:38PM +0800, Julia Lawall wrote:
> > On Mon, 7 Nov 2022, Uwe Kleine-König wrote:
> >
> > > devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to
> > > the shorter devm_platform_ioremap_resource(pdev, index).
> > >
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> > > ---
> > > Hello,
> > >
> > > a potential improvement is to check for invocations of
> > > devm_platform_get_and_ioremap_resource() where the res parameter isn't
> > > used afterwards, but my coccinelle foo isn't strong enough for that.
> >
> > ... when != res
> >
> > I'm not sure where you wanted to put it though.
>
> I tinkered a bit further and even succeeded to remove the declaration if
> it's otherwise unused.
>
> I failed to test the report mode, my spatch tells me some error about
> python2?!

For the record, that is a problem with Debian's coccinelle, bugreport
at https://bugs.debian.org/1023653

Best regards
Uwe

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

Attachment: signature.asc
Description: PGP signature