Re: [cocci] Checking data structure member accesses after function return value assignments?
Julia Lawall <[email protected]> Tue, 20 Jan 2026 07:45:38 -0500 (EST)
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 20 Jan 2026, Markus Elfring wrote:
> > I can try another SmPL script example out:
>
> @display_without_extra_semicolon@
> expression action;
> expression * pointer;
> identifier member;
> @@
> *pointer = action(...);
> <+...
> *pointer->member
> ...+>
And yet I made another suggestion that you completely ignored:
* pointer = action(...);
(<+...
* pointer->member
...+>);
This should you give what you seemed to want, with pointer->member in the
immediately following statement only.
julia
>
>
> > Do you imagine any further data processing refinements?
>
> Corresponding test result:
> Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --no-loops …/Projekte/Coccinelle/janitor/show_questionable_statement_combination6.cocci drivers/regulator/fp9931.c
> …
> @@ -438,44 +438,21 @@ static int fp9931_probe(struct i2c_clien
> …
> - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
> - data->regmap = devm_regmap_init_i2c(client, ®map_config);
> - if (IS_ERR(data->regmap))
> …
> @@ -501,7 +478,6 @@ static int fp9931_probe(struct i2c_clien
>
> config.driver_data = data;
> config.dev = &client->dev;
> - config.regmap = data->regmap;
>
> for (i = 0; i < ARRAY_SIZE(regulators); i++) {
> rdev = devm_regulator_register(&client->dev, ®ulators[i],
>
> real 0m1,057s
> user 0m1,008s
> sys 0m0,026s
>
>
> Regards,
> Markus
>