Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1277380 > unrolled thread

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

Started byGeliang Tang <geliangtang@163.com>
First post2015-11-25 14:20 +0100
Last post2015-11-25 21:30 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/7] ARM: davinci: fix a problematic usage of WARN() Geliang Tang <geliangtang@163.com> - 2015-11-25 14:20 +0100
    Re: [PATCH 6/7] ARM: davinci: fix a problematic usage of WARN() Arnd Bergmann <arnd@arndb.de> - 2015-11-25 14:50 +0100
      [PATCH v2] ARM: davinci: fix a problematic usage of WARN() Geliang Tang <geliangtang@163.com> - 2015-11-25 15:20 +0100
        Re: [PATCH v2] ARM: davinci: fix a problematic usage of WARN() kbuild test robot <lkp@intel.com> - 2015-11-25 21:30 +0100

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

FromGeliang Tang <geliangtang@163.com>
Date2015-11-25 14:20 +0100
Subject[PATCH 6/7] ARM: davinci: fix a problematic usage of WARN()
Message-ID<qyI9j-6MK-5@gated-at.bofh.it>
WARN() takes a condition and a format string. The condition was
omitted. So I added it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 arch/arm/mach-davinci/board-dm355-evm.c     | 2 +-
 arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index c71dd99..e47f24c 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ 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);
 
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 680a7a2..83b625c 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -243,7 +243,7 @@ static __init void dm355_leopard_init(void)
 
 	aemif = clk_get(&dm355leopard_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);
 
-- 
2.5.0


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

[toc] | [next] | [standalone]


#1277403

FromArnd Bergmann <arnd@arndb.de>
Date2015-11-25 14:50 +0100
Message-ID<qyICm-6XN-23@gated-at.bofh.it>
In reply to#1277380
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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1277414 — [PATCH v2] ARM: davinci: fix a problematic usage of WARN()

FromGeliang Tang <geliangtang@163.com>
Date2015-11-25 15:20 +0100
Subject[PATCH v2] ARM: davinci: fix a problematic usage of WARN()
Message-ID<qyJ5n-7oe-1@gated-at.bofh.it>
In reply to#1277403
WARN() takes a condition and a format string. The condition was
omitted. So I added it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
Changes in v2:
 - remove __func__ in WARN()
---
 arch/arm/mach-davinci/board-dm355-evm.c     | 4 +---
 arch/arm/mach-davinci/board-dm355-leopard.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index c71dd99..3c79796 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -384,9 +384,7 @@ static __init void dm355_evm_init(void)
 	dm355evm_dm9000_rsrc[2].start = gpio_to_irq(1);
 
 	aemif = clk_get(&dm355evm_dm9000.dev, "aemif");
-	if (IS_ERR(aemif))
-		WARN("%s: unable to get AEMIF clock\n", __func__);
-	else
+	if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
 		clk_prepare_enable(aemif);
 
 	platform_add_devices(davinci_evm_devices,
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 680a7a2..627ba89 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -242,9 +242,7 @@ static __init void dm355_leopard_init(void)
 	dm355leopard_dm9000_rsrc[2].start = gpio_to_irq(9);
 
 	aemif = clk_get(&dm355leopard_dm9000.dev, "aemif");
-	if (IS_ERR(aemif))
-		WARN("%s: unable to get AEMIF clock\n", __func__);
-	else
+	if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
 		clk_prepare_enable(aemif);
 
 	platform_add_devices(davinci_leopard_devices,
-- 
2.5.0


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

[toc] | [prev] | [next] | [standalone]


#1277783 — Re: [PATCH v2] ARM: davinci: fix a problematic usage of WARN()

Fromkbuild test robot <lkp@intel.com>
Date2015-11-25 21:30 +0100
SubjectRe: [PATCH v2] ARM: davinci: fix a problematic usage of WARN()
Message-ID<qyORr-2F7-3@gated-at.bofh.it>
In reply to#1277414

[Multipart message — attachments visible in raw view] — view raw

Hi Geliang,

[auto build test ERROR on arm-soc/for-next]
[also build test ERROR on v4.4-rc2 next-20151124]

url:    https://github.com/0day-ci/linux/commits/Geliang-Tang/ARM-davinci-fix-a-problematic-usage-of-WARN/20151125-221653
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
config: arm-davinci_all_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   In file included from arch/arm/include/asm/bug.h:62:0,
                    from arch/arm/include/asm/div64.h:63,
                    from include/linux/kernel.h:136,
                    from arch/arm/mach-davinci/board-dm355-evm.c:11:
   arch/arm/mach-davinci/board-dm355-evm.c: In function 'dm355_evm_init':
>> include/asm-generic/bug.h:74:72: error: expected expression before ')' token
    #define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
                                                                           ^
   include/asm-generic/bug.h:97:3: note: in expansion of macro '__WARN_printf'
      __WARN_printf(format);     \
      ^
>> arch/arm/mach-davinci/board-dm355-evm.c:387:7: note: in expansion of macro 'WARN'
     if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
          ^
   arch/arm/mach-davinci/board-dm355-evm.c:387:6: warning: value computed is not used [-Wunused-value]
     if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
         ^
>> arch/arm/mach-davinci/board-dm355-evm.c:387:58: error: expected statement before ')' token
     if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
                                                             ^
--
   In file included from arch/arm/include/asm/bug.h:62:0,
                    from arch/arm/include/asm/div64.h:63,
                    from include/linux/kernel.h:136,
                    from arch/arm/mach-davinci/board-dm355-leopard.c:10:
   arch/arm/mach-davinci/board-dm355-leopard.c: In function 'dm355_leopard_init':
>> include/asm-generic/bug.h:74:72: error: expected expression before ')' token
    #define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
                                                                           ^
   include/asm-generic/bug.h:97:3: note: in expansion of macro '__WARN_printf'
      __WARN_printf(format);     \
      ^
>> arch/arm/mach-davinci/board-dm355-leopard.c:245:7: note: in expansion of macro 'WARN'
     if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
          ^
   arch/arm/mach-davinci/board-dm355-leopard.c:245:6: warning: value computed is not used [-Wunused-value]
     if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
         ^
>> arch/arm/mach-davinci/board-dm355-leopard.c:245:58: error: expected statement before ')' token
     if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
                                                             ^

vim +387 arch/arm/mach-davinci/board-dm355-evm.c

   381	
   382		gpio_request(1, "dm9000");
   383		gpio_direction_input(1);
   384		dm355evm_dm9000_rsrc[2].start = gpio_to_irq(1);
   385	
   386		aemif = clk_get(&dm355evm_dm9000.dev, "aemif");
 > 387		if (!WARN(IS_ERR(aemif)), "unable to get AEMIF clock\n"))
   388			clk_prepare_enable(aemif);
   389	
   390		platform_add_devices(davinci_evm_devices,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web