[PATCH] block: follow links before check if cdev_is_block_partition

Marco Felsch m.felsch at pengutronix.de
Wed Jul 23 08:55:45 PDT 2025


cdev_is_block_partition() fails if a cdev is passed which is a
parition-link. Most of our barebox code is link-aware by resolving the
links first.

Make it more user-friendly and resolve the possible cdev parttion link
first before performing the actual check.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 include/block.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/block.h b/include/block.h
index 5ce3eb7d7838..a5a2dcf58995 100644
--- a/include/block.h
+++ b/include/block.h
@@ -107,6 +107,7 @@ static inline bool cdev_is_block_device(const struct cdev *cdev)
 
 static inline bool cdev_is_block_partition(const struct cdev *cdev)
 {
+	cdev = cdev_readlink(cdev);
 	return cdev_is_block_device(cdev) && cdev_is_partition(cdev);
 }
 
-- 
2.39.5




More information about the barebox mailing list