[PATCH v2 03/19] cdev: fix for_each_cdev macro

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jun 7 05:06:58 PDT 2023


The macro parameter 'c' was never used, instead hardcoding cdev.
It worked so far anyway, because all users of for_each_cdev used cdev
as the argument. Fix this.

While at it, surround cdev with parenthesis to avoid associativity
issues.

Reviewed-by: Marco Felsch <m.felsch at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
  - add parenthesis around cdev (Ulrich)
  - add Marco's Reviewed-by
---
 include/driver.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/driver.h b/include/driver.h
index d33e0fcbccc9..66ae52d0004c 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -566,8 +566,8 @@ int cdev_truncate(struct cdev*, size_t size);
 loff_t cdev_unallocated_space(struct cdev *cdev);
 
 extern struct list_head cdev_list;
-#define for_each_cdev(c) \
-	list_for_each_entry(cdev, &cdev_list, list)
+#define for_each_cdev(cdev) \
+	list_for_each_entry((cdev), &cdev_list, list)
 
 #define DEVFS_PARTITION_FIXED		(1U << 0)
 #define DEVFS_PARTITION_READONLY	(1U << 1)
-- 
2.39.2




More information about the barebox mailing list