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

From: Arnd Bergmann
Date: Wed Nov 25 2015 - 08:41:22 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/