Re: [cocci] Checking data structure member accesses after function return value assignments?

Markus Elfring <[email protected]> Tue, 20 Jan 2026 09:47:32 +0100
Newsgroups fr.inria.cocci
Message-ID <[email protected]>
> I can try another SmPL script example out:

@display_without_extra_semicolon@
expression action;
expression * pointer;
identifier member;
@@
*pointer = action(...);
 <+...
*pointer->member
 ...+>


> 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, &regmap_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, &regulators[i],

real    0m1,057s
user    0m1,008s
sys     0m0,026s


Regards,
Markus