[PATCH] block: follow links before check if cdev_is_block_partition

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Jul 24 04:28:12 PDT 2025


On 7/23/25 17:55, Marco Felsch wrote:
> 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>

Acked-by: Ahmad Fatoum <a.fatoum 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);
>  }
>  

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list