Re: [PATCH v2] mtd: consult CONFIG_OFDEVICE in mtd_get_of_node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 11, 2023 at 06:35:48PM +0100, Ahmad Fatoum wrote:
> Get barebox on non-DT platforms with NAND a tiny bit smaller by
> directly returning NULL if CONFIG_OFDEVICE is not enabled, thereby
> allowing more code to be discarded at compile-time in absence of
> link-time optimization.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> ---
> v1 -> v2:
>   - don't dereference parent device without NULL-check (Sascha)
> ---
>  include/linux/mtd/mtd.h | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index 6b539a9eceb5..54cb2ec64ce2 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -293,6 +293,8 @@ static inline void mtd_set_of_node(struct mtd_info *mtd,
>  
>  static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
>  {
> +	if (!IS_ENABLED(CONFIG_OFDEVICE))
> +		return NULL;
>  	if (mtd->dev.of_node)
>  		return mtd->dev.of_node;
>  	if (mtd->dev.parent)
> -- 
> 2.30.2
> 
> 
> 

-- 
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 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux