[PATCH 6/7] ARM: davinci: fix a problematic usage of WARN()

Arnd Bergmann arnd at arndb.de
Wed Nov 25 05:39:44 PST 2015


On Wednesday 25 November 2015 21:12:19 Geliang Tang wrote:
> +++ b/arch/arm/mach-davinci/board-dm355-evm.c
> @@ -385,7 +385,7 @@ static __init void dm355_evm_init(void)
>  
>         aemif = clk_get(&dm355evm_dm9000.dev, "aemif");
>         if (IS_ERR(aemif))
> -               WARN("%s: unable to get AEMIF clock\n", __func__);
> +               WARN(1, "%s: unable to get AEMIF clock\n", __func__);
>         else
>                 clk_prepare_enable(aemif);
>  
> 

How about writing this as 

	if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
		clk_prepare_enable(aemif);

Note that WARN() already contains file and line, so you don't really
need the __func__ here either.

	Arnd



More information about the linux-arm-kernel mailing list