* [cocci] [PATCH v1] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL @ 2022-11-07 11:47 Uwe Kleine-König 2022-11-07 12:45 ` Julia Lawall ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Uwe Kleine-König @ 2022-11-07 11:47 UTC (permalink / raw) To: Julia Lawall, Nicolas Palix; +Cc: linux-kernel, cocci, kernel 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@pengutronix.de> --- 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. Best regards Uwe .../api/devm_platform_ioremap_resource.cocci | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci diff --git a/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci b/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci new file mode 100644 index 000000000000..401610b9a17d --- /dev/null +++ b/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: GPL-2.0-only +/// Don't use devm_platform_get_and_ioremap_resource with NULL as third parameter +// Confidence: High + +virtual patch +virtual context +virtual org +virtual report + +@r1@ +position p; +@@ + devm_platform_ioremap_resource(...) { + ... + devm_platform_get_and_ioremap_resource@p(...) + ... + } + +@depends on patch@ +expression pdev,index; +position p != r1.p; +@@ + +- devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) ++ devm_platform_ioremap_resource(pdev, index) + +@r2 depends on !patch exists@ +expression pdev,index; +position p; +@@ + +* devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) + +@script:python depends on org@ +p << r2.p; +@@ + +cocci.print_main("WARNING opportunity for devm_platform_ioremap_resource", p) + +@script:python depends on report@ +p << r2.p; +@@ + +coccilib.report.print_report(p[0], "WARNING opportunity for devm_platform_ioremap_resource") -- 2.38.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH v1] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 11:47 [cocci] [PATCH v1] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL Uwe Kleine-König @ 2022-11-07 12:45 ` Julia Lawall 2022-11-07 18:11 ` [cocci] [PATCH v2] " Uwe Kleine-König 2022-11-07 19:00 ` [cocci] [PATCH] " Markus Elfring 2022-11-09 18:50 ` Markus Elfring 2 siblings, 1 reply; 14+ messages in thread From: Julia Lawall @ 2022-11-07 12:45 UTC (permalink / raw) To: Uwe Kleine-König Cc: Julia Lawall, Nicolas Palix, linux-kernel, cocci, kernel [-- Attachment #1: Type: text/plain, Size: 2111 bytes --] 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@pengutronix.de> > --- > 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. julia > > Best regards > Uwe > > .../api/devm_platform_ioremap_resource.cocci | 44 +++++++++++++++++++ > 1 file changed, 44 insertions(+) > create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci > > diff --git a/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci b/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci > new file mode 100644 > index 000000000000..401610b9a17d > --- /dev/null > +++ b/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci > @@ -0,0 +1,44 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/// Don't use devm_platform_get_and_ioremap_resource with NULL as third parameter > +// Confidence: High > + > +virtual patch > +virtual context > +virtual org > +virtual report > + > +@r1@ > +position p; > +@@ > + devm_platform_ioremap_resource(...) { > + ... > + devm_platform_get_and_ioremap_resource@p(...) > + ... > + } > + > +@depends on patch@ > +expression pdev,index; > +position p != r1.p; > +@@ > + > +- devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) > ++ devm_platform_ioremap_resource(pdev, index) > + > +@r2 depends on !patch exists@ > +expression pdev,index; > +position p; > +@@ > + > +* devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) > + > +@script:python depends on org@ > +p << r2.p; > +@@ > + > +cocci.print_main("WARNING opportunity for devm_platform_ioremap_resource", p) > + > +@script:python depends on report@ > +p << r2.p; > +@@ > + > +coccilib.report.print_report(p[0], "WARNING opportunity for devm_platform_ioremap_resource") > -- > 2.38.1 > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* [cocci] [PATCH v2] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 12:45 ` Julia Lawall @ 2022-11-07 18:11 ` Uwe Kleine-König 2022-11-10 15:07 ` Uwe Kleine-König 0 siblings, 1 reply; 14+ messages in thread From: Uwe Kleine-König @ 2022-11-07 18:11 UTC (permalink / raw) To: Julia Lawall; +Cc: kernel, Nicolas Palix, linux-kernel, cocci [-- Attachment #1: Type: text/plain, Size: 3637 bytes --] 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@pengutronix.de> --- 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@pengutronix.de> > > --- > > 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?! Best regards Uwe .../api/devm_platform_ioremap_resource.cocci | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci diff --git a/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci b/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci new file mode 100644 index 000000000000..485dfa6ea0aa --- /dev/null +++ b/scripts/coccinelle/api/devm_platform_ioremap_resource.cocci @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-2.0-only +/// Don't use devm_platform_get_and_ioremap_resource with NULL as third parameter +// Confidence: High + +virtual patch +virtual context +virtual org +virtual report + +@r1@ +position p; +@@ + devm_platform_ioremap_resource(...) { + ... + devm_platform_get_and_ioremap_resource@p(...) + ... + } + +@depends on patch@ +expression pdev,index; +position p != r1.p; +@@ + +- devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) ++ devm_platform_ioremap_resource(pdev, index) + +@depends on patch@ +expression pdev,index; +identifier res; +type T; +@@ +- T res; + ... when != res +- devm_platform_get_and_ioremap_resource(pdev, index, &res) ++ devm_platform_ioremap_resource(pdev, index) + ... when != res + +@depends on patch@ +expression pdev,index; +identifier res; +@@ + +- devm_platform_get_and_ioremap_resource(pdev, index, &res) ++ devm_platform_ioremap_resource(pdev, index) + ... when != res + +@r2 depends on !patch exists@ +expression pdev,index; +position p; +@@ + +* devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) + +@script:python depends on org@ +p << r2.p; +@@ + +cocci.print_main("WARNING opportunity for devm_platform_ioremap_resource", p) + +@script:python depends on report@ +p << r2.p; +@@ + +coccilib.report.print_report(p[0], "WARNING opportunity for devm_platform_ioremap_resource") + +@r3 depends on !patch exists@ +expression pdev,index; +identifier res; +position p; +@@ + +* devm_platform_get_and_ioremap_resource@p(pdev, index, &res) + ... when != res + +@script:python depends on org@ +p << r3.p; +@@ + +cocci.print_main("WARNING opportunity for devm_platform_ioremap_resource", p) + +@script:python depends on report@ +p << r3.p; +@@ + +coccilib.report.print_report(p[0], "WARNING opportunity for devm_platform_ioremap_resource") -- 2.38.1 -- 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 --] ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH v2] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 18:11 ` [cocci] [PATCH v2] " Uwe Kleine-König @ 2022-11-10 15:07 ` Uwe Kleine-König 0 siblings, 0 replies; 14+ messages in thread From: Uwe Kleine-König @ 2022-11-10 15:07 UTC (permalink / raw) To: Julia Lawall; +Cc: Nicolas Palix, linux-kernel, kernel, cocci [-- Attachment #1: Type: text/plain, Size: 1459 bytes --] 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@pengutronix.de> > --- > 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@pengutronix.de> > > > --- > > > 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 #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 11:47 [cocci] [PATCH v1] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL Uwe Kleine-König 2022-11-07 12:45 ` Julia Lawall @ 2022-11-07 19:00 ` Markus Elfring 2022-11-07 20:08 ` Uwe Kleine-König 2022-11-09 18:50 ` Markus Elfring 2 siblings, 1 reply; 14+ messages in thread From: Markus Elfring @ 2022-11-07 19:00 UTC (permalink / raw) To: Uwe Kleine-König, cocci Cc: Julia Lawall, Nicolas Palix, linux-kernel, kernel-janitors, kernel > devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to > the shorter devm_platform_ioremap_resource(pdev, index). … > create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci … > +@depends on patch@ > +expression pdev,index; > +position p != r1.p; Why do you think that different source code positions would be required for your transformation approach? > +@@ > + > +- devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) > ++ devm_platform_ioremap_resource(pdev, index) I suggest to use the following SmPL code variant instead. -devm_platform_get_and_ioremap_resource@p +devm_platform_ioremap_resource (pdev, index - , NULL ) > +@r2 depends on !patch exists@ > +expression pdev,index; > +position p; > +@@ > + > +* devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) I doubt that the usage of the SmPL asterisk is appropriate for the operation modes “org” and “report”. Regards, Markus ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 19:00 ` [cocci] [PATCH] " Markus Elfring @ 2022-11-07 20:08 ` Uwe Kleine-König 2022-11-07 21:40 ` Markus Elfring ` (3 more replies) 0 siblings, 4 replies; 14+ messages in thread From: Uwe Kleine-König @ 2022-11-07 20:08 UTC (permalink / raw) To: Markus Elfring Cc: cocci, Julia Lawall, kernel-janitors, Nicolas Palix, linux-kernel, kernel [-- Attachment #1: Type: text/plain, Size: 3678 bytes --] On Mon, Nov 07, 2022 at 08:00:33PM +0100, Markus Elfring wrote: > > > devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to > > the shorter devm_platform_ioremap_resource(pdev, index). > … > > create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci > … > > +@depends on patch@ > > +expression pdev,index; > > +position p != r1.p; > > > Why do you think that different source code positions would be required for > your transformation approach? That is important that the implementation of devm_platform_ioremap_resource isn't adapted. > > +@@ > > + > > +- devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) > > ++ devm_platform_ioremap_resource(pdev, index) > > I suggest to use the following SmPL code variant instead. > > -devm_platform_get_and_ioremap_resource@p > +devm_platform_ioremap_resource > (pdev, index > - , NULL > ) I don't care much, but IMHO my variant is easier to read. Might be subjective, though. > > +@r2 depends on !patch exists@ > > +expression pdev,index; > > +position p; > > +@@ > > + > > +* devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) > > > I doubt that the usage of the SmPL asterisk is appropriate for the operation > modes “org” and “report”. I have no idea about org and report modes. When I try these I get a python2 error message: uwe@taurus:~/gsrc/linux$ make coccicheck You have not explicitly specified the mode to use. Using default "report" mode. Available modes are the following: patch, report, context, org, chain You can specify the mode with "make coccicheck MODE=<mode>" Note however that some modes are not implemented by some semantic patches. Please check for false positives in the output before submitting a patch. When using "patch" mode, carefully review the patch before submitting it. /usr/bin/spatch -D report --no-show-diff --very-quiet --cocci-file ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h --jobs 4 --chunksize 1 Py.find_library: unable to find the Python library [libpython2.7m.so returned libpython2.7m.so: cannot open shared object file: No such file or directory] [/usr/bin/../lib/libpython2.7m.so returned /usr/bin/../lib/libpython2.7m.so: cannot open shared object file: No such file or directory] [libpython2.7.so returned libpython2.7.so: cannot open shared object file: No such file or directory] [/usr/bin/../lib/libpython2.7.so returned /usr/bin/../lib/libpython2.7.so: cannot open shared object file: No such file or directory] coccicheck failed make: *** [Makefile:2076: coccicheck] Error 255 After uninstalling python2 this ends in: Cannot find Python library coccicheck failed make: *** [Makefile:2076: coccicheck] Error 255 Didn't try to debug that any further. Is that worth a bug report against coccinelle (which is shipped by my distribution)? I tried to adapt the org and report modes from other patches in the same directory. So a critical glimpse by someone more knowledgable than me is recommended. However I don't know how to react to "I doubt ... is appropriate", I'd need a more constructive feedback to act on. Best regards 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 --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 20:08 ` Uwe Kleine-König @ 2022-11-07 21:40 ` Markus Elfring 2022-11-08 5:51 ` Julia Lawall ` (2 subsequent siblings) 3 siblings, 0 replies; 14+ messages in thread From: Markus Elfring @ 2022-11-07 21:40 UTC (permalink / raw) To: Uwe Kleine-König, cocci Cc: Julia Lawall, Nicolas Palix, linux-kernel, kernel-janitors, kernel >>> devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to >>> the shorter devm_platform_ioremap_resource(pdev, index). >> … >>> create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci >> … >>> +@depends on patch@ >>> +expression pdev,index; >>> +position p != r1.p; >> >> Why do you think that different source code positions would be required for >> your transformation approach? > That is important that the implementation of > devm_platform_ioremap_resource isn't adapted. Can this design desire result in an other solution approach for a possible script with the semantic patch language? >>> +@@ >>> + >>> +- devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) >>> ++ devm_platform_ioremap_resource(pdev, index) >> I suggest to use the following SmPL code variant instead. >> >> -devm_platform_get_and_ioremap_resource@p >> +devm_platform_ioremap_resource >> (pdev, index >> - , NULL >> ) > I don't care much, I propose to reconsider this view a bit more. > but IMHO my variant is easier to read. This can be. I am trying again to point further development concerns out. Would you occasionally like to modify only essential source code places? > Might be subjective, though. Yes, of course. >>> +@r2 depends on !patch exists@ >>> +expression pdev,index; >>> +position p; >>> +@@ >>> + >>> +* devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) >> >> I doubt that the usage of the SmPL asterisk is appropriate for the operation >> modes “org” and “report”. > I have no idea about org and report modes. Please take another look at relevant application differences. > When I try these I get a python2 error message: How do you think about to switch to a newer version of the interpreter for the Python programming language? Regards, Markus ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 20:08 ` Uwe Kleine-König 2022-11-07 21:40 ` Markus Elfring @ 2022-11-08 5:51 ` Julia Lawall 2022-11-08 7:55 ` Nicolas Palix 2022-11-08 19:40 ` [cocci] [PATCH] " Markus Elfring 2022-11-09 18:00 ` Markus Elfring 3 siblings, 1 reply; 14+ messages in thread From: Julia Lawall @ 2022-11-08 5:51 UTC (permalink / raw) To: Uwe Kleine-König Cc: Markus Elfring, cocci, kernel-janitors, nicolas palix, linux-kernel, kernel > After uninstalling python2 this ends in: > > Cannot find Python library > coccicheck failed > make: *** [Makefile:2076: coccicheck] Error 255 > > Didn't try to debug that any further. Is that worth a bug report against > coccinelle (which is shipped by my distribution)? > > I tried to adapt the org and report modes from other patches in the same > directory. So a critical glimpse by someone more knowledgable than me is > recommended. However I don't know how to react to "I doubt ... is > appropriate", I'd need a more constructive feedback to act on. I'm not a python expert, so I'm not sure what to do about this python2 vs python3 problem. Is there some strategy for printing that works in both of them? julia ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-08 5:51 ` Julia Lawall @ 2022-11-08 7:55 ` Nicolas Palix 2022-11-08 9:54 ` Uwe Kleine-König 0 siblings, 1 reply; 14+ messages in thread From: Nicolas Palix @ 2022-11-08 7:55 UTC (permalink / raw) To: Julia Lawall, Uwe Kleine-König Cc: Markus Elfring, cocci, kernel-janitors, nicolas palix, linux-kernel, kernel Hi all, On 08/11/2022 06:51, Julia Lawall wrote: > >> After uninstalling python2 this ends in: >> >> Cannot find Python library >> coccicheck failed >> make: *** [Makefile:2076: coccicheck] Error 255 >> >> Didn't try to debug that any further. Is that worth a bug report against >> coccinelle (which is shipped by my distribution)? >> >> I tried to adapt the org and report modes from other patches in the same >> directory. So a critical glimpse by someone more knowledgable than me is >> recommended. However I don't know how to react to "I doubt ... is >> appropriate", I'd need a more constructive feedback to act on. > > I'm not a python expert, so I'm not sure what to do about this python2 vs python3 problem. Is there some strategy for printing that works in both of them? It sounds like a missing dependency in the package system of the distribution. Coccinelle has been build with Python support, but some libraries are missing. Which distribution is it ? Can you install some packages that provide the two missing shared librairies ? > > julia -- Nicolas Palix +33 4 574 21538 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-08 7:55 ` Nicolas Palix @ 2022-11-08 9:54 ` Uwe Kleine-König 2022-11-08 12:21 ` [cocci] " Markus Elfring 0 siblings, 1 reply; 14+ messages in thread From: Uwe Kleine-König @ 2022-11-08 9:54 UTC (permalink / raw) To: Nicolas Palix Cc: Julia Lawall, nicolas palix, kernel-janitors, linux-kernel, Markus Elfring, kernel, cocci [-- Attachment #1: Type: text/plain, Size: 1520 bytes --] Hello, On Tue, Nov 08, 2022 at 08:55:04AM +0100, Nicolas Palix wrote: > On 08/11/2022 06:51, Julia Lawall wrote: > > > > > After uninstalling python2 this ends in: > > > > > > Cannot find Python library > > > coccicheck failed > > > make: *** [Makefile:2076: coccicheck] Error 255 > > > > > > Didn't try to debug that any further. Is that worth a bug report against > > > coccinelle (which is shipped by my distribution)? > > > > > > I tried to adapt the org and report modes from other patches in the same > > > directory. So a critical glimpse by someone more knowledgable than me is > > > recommended. However I don't know how to react to "I doubt ... is > > > appropriate", I'd need a more constructive feedback to act on. > > > > I'm not a python expert, so I'm not sure what to do about this python2 vs python3 problem. Is there some strategy for printing that works in both of them? > > It sounds like a missing dependency in the package system of the > distribution. Coccinelle has been build with Python support, but > some libraries are missing. > > Which distribution is it ? > Can you install some packages that provide the two missing shared librairies > ? After installing python-is-python3 (which provides a symlink /usr/bin/python -> python3) it works. This is on Debian testing. Best regards 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 --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-08 9:54 ` Uwe Kleine-König @ 2022-11-08 12:21 ` Markus Elfring 0 siblings, 0 replies; 14+ messages in thread From: Markus Elfring @ 2022-11-08 12:21 UTC (permalink / raw) To: Uwe Kleine-König Cc: Nicolas Palix, Julia Lawall, kernel-janitors, linux-kernel, kernel, cocci, Nicolas Palix > After installing python-is-python3 (which provides a symlink > /usr/bin/python -> python3) it works. This is on Debian testing. Would you occasionally like to use the parameter “--python” for the program “spatch”? Regards, Markus ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 20:08 ` Uwe Kleine-König 2022-11-07 21:40 ` Markus Elfring 2022-11-08 5:51 ` Julia Lawall @ 2022-11-08 19:40 ` Markus Elfring 2022-11-09 18:00 ` Markus Elfring 3 siblings, 0 replies; 14+ messages in thread From: Markus Elfring @ 2022-11-08 19:40 UTC (permalink / raw) To: Uwe Kleine-König, Julia Lawall, Nicolas Palix, cocci Cc: kernel-janitors, linux-kernel, kernel >>> devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to >>> the shorter devm_platform_ioremap_resource(pdev, index). Would you like to add an imperative wording to the patch description? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.1-rc4#n94 > I have no idea about org and report modes. Do you get any additional development ideas from information of previous messages? Example: 2020-09-07 [PATCH v2] Coccinelle: api: Add SmPL script “use_devm_platform_get_and_ioremap_resource.cocci” https://www.mail-archive.com/cocci@systeme.lip6.fr/msg08157.html https://lkml.org/lkml/2020/9/7/960 > After uninstalling python2 this ends in: > > Cannot find Python library > coccicheck failed > make: *** [Makefile:2076: coccicheck] Error 255 With which script language versions are you going to work further? > So a critical glimpse by someone more knowledgable than me is recommended. I am curious how such patch reviews will evolve further. > However I don't know how to react to "I doubt ... is appropriate", > I'd need a more constructive feedback to act on. How do you think about to improve the knowledge for applied data output formats? Regards, Markus ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 20:08 ` Uwe Kleine-König ` (2 preceding siblings ...) 2022-11-08 19:40 ` [cocci] [PATCH] " Markus Elfring @ 2022-11-09 18:00 ` Markus Elfring 3 siblings, 0 replies; 14+ messages in thread From: Markus Elfring @ 2022-11-09 18:00 UTC (permalink / raw) To: Uwe Kleine-König, Julia Lawall, Nicolas Palix Cc: cocci, kernel-janitors, linux-kernel, kernel >>> devm_platform_get_and_ioremap_resource(pdev, index, NULL) is equivalent to >>> the shorter devm_platform_ioremap_resource(pdev, index). >> … >>> create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci >> … >>> +@depends on patch@ >>> +expression pdev,index; >>> +position p != r1.p; >> >> Why do you think that different source code positions would be required for >> your transformation approach? > That is important that the implementation of devm_platform_ioremap_resource > isn't adapted. You would like to exclude the modification of a known function implementation. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/platform.c?h=v6.1-rc4#n112 https://elixir.bootlin.com/linux/v6.1-rc4/source/drivers/base/platform.c#L112 >>> +@@ >>> + >>> +- devm_platform_get_and_ioremap_resource@p(pdev, index, NULL) >>> ++ devm_platform_ioremap_resource(pdev, index) Can the following SmPL code variant be more appropriate? @preserve@ @@ devm_platform_ioremap_resource(...) { ... } @replacement depends on !preserve && patch@ expression pdev, index; @@ -devm_platform_get_and_ioremap_resource +devm_platform_ioremap_resource (pdev, index - , NULL ) Regards, Markus ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [cocci] [PATCH] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL 2022-11-07 11:47 [cocci] [PATCH v1] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL Uwe Kleine-König 2022-11-07 12:45 ` Julia Lawall 2022-11-07 19:00 ` [cocci] [PATCH] " Markus Elfring @ 2022-11-09 18:50 ` Markus Elfring 2 siblings, 0 replies; 14+ messages in thread From: Markus Elfring @ 2022-11-09 18:50 UTC (permalink / raw) To: Uwe Kleine-König, Julia Lawall, Nicolas Palix, cocci Cc: kernel-janitors, linux-kernel, kernel > create mode 100644 scripts/coccinelle/api/devm_platform_ioremap_resource.cocci Can the file name “use_devm_platform_ioremap_resource.cocci” be a bit nicer? > +@script:python depends on org@ > +p << r2.p; > +@@ > + > +cocci.print_main("WARNING opportunity for devm_platform_ioremap_resource", p) Can the following statement variant be more appropriate? coccilib.org.print_todo(p[0], "WARNING: opportunity for devm_platform_ioremap_resource()") Regards, Markus ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-11-11 1:25 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-11-07 11:47 [cocci] [PATCH v1] coccinelle: api: Don't use devm_platform_get_and_ioremap_resource with res==NULL Uwe Kleine-König 2022-11-07 12:45 ` Julia Lawall 2022-11-07 18:11 ` [cocci] [PATCH v2] " Uwe Kleine-König 2022-11-10 15:07 ` Uwe Kleine-König 2022-11-07 19:00 ` [cocci] [PATCH] " Markus Elfring 2022-11-07 20:08 ` Uwe Kleine-König 2022-11-07 21:40 ` Markus Elfring 2022-11-08 5:51 ` Julia Lawall 2022-11-08 7:55 ` Nicolas Palix 2022-11-08 9:54 ` Uwe Kleine-König 2022-11-08 12:21 ` [cocci] " Markus Elfring 2022-11-08 19:40 ` [cocci] [PATCH] " Markus Elfring 2022-11-09 18:00 ` Markus Elfring 2022-11-09 18:50 ` Markus Elfring
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).