Skip to content

Commit ff82e84

Browse files
committed
coccinelle: device_attr_show: simplify patch case
Replacing the final expression argument by ... allows the format string to have multiple arguments. It also has the advantage of allowing the change to be recognized as a change in a single statement, thus avoiding adding unneeded braces. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
1 parent 68ea60a commit ff82e84

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

scripts/coccinelle/api/device_attr_show.cocci

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@ expression BUF, SZ, FORMAT, STR;
3434
ssize_t show(struct device *dev, struct device_attribute *attr, char *buf)
3535
{
3636
<...
37-
(
3837
return
39-
- snprintf(BUF, SZ, FORMAT, STR);
40-
+ sysfs_emit(BUF, FORMAT, STR);
41-
|
42-
return
43-
- snprintf(BUF, SZ, STR);
44-
+ sysfs_emit(BUF, STR);
45-
)
38+
- snprintf(BUF, SZ, FORMAT
39+
+ sysfs_emit(BUF, FORMAT
40+
,...);
4641
...>
4742
}
4843

0 commit comments

Comments
 (0)