[PATCH] common: driver: fixes argument name mismatch in for_each_cdev

michael.kopfensteiner at vahle.com michael.kopfensteiner at vahle.com
Wed Jun 14 06:51:33 PDT 2023

From: Michael Kopfensteiner <michael.kopfensteiner at vahle.com>

The for_each_cdev makro takes a pointer argument as loop cursor.
Due to a name mismatch, not the provided pointer was used but
whatever was called `cdev`.
This mismatch had no effect, because in every usage the given
pointer is named cdev anyway.

This commit fixes the name-mismatch. The makro now works with
arguments name differently than 'cdev' too.
 include/driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/driver.h b/include/driver.h
index d33e0fcbcc..e1ee3dc2dd 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -566,7 +566,7 @@ 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) \
+#define for_each_cdev(cdev) \
 	list_for_each_entry(cdev, &cdev_list, list)
 #define DEVFS_PARTITION_FIXED		(1U << 0)

More information about the barebox mailing list