LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] powerpc/mm/radix: add missing braces for single statement block
@ 2018-04-08 19:44 Mathieu Malaterre
2018-04-08 20:34 ` Randy Dunlap
2018-04-23 19:36 ` [PATCH v2] powerpc/mm/radix: use do/while(0) trick " Mathieu Malaterre
0 siblings, 2 replies; 7+ messages in thread
From: Mathieu Malaterre @ 2018-04-08 19:44 UTC (permalink / raw)
To: Michael Ellerman
Cc: Mathieu Malaterre, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev, linux-kernel
In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for
disable_radix") an `if` statement was added for a possible empty body
(prom_debug).
Fix the following warning, treated as error with W=1:
arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
arch/powerpc/kernel/prom_init.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5ae153b97d0a..f0e802495530 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -652,8 +652,9 @@ static void __init early_cmdline_parse(void)
} else
prom_radix_disable = true;
}
- if (prom_radix_disable)
+ if (prom_radix_disable) {
prom_debug("Radix disabled from cmdline\n");
+ }
}
#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
--
2.11.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/mm/radix: add missing braces for single statement block
2018-04-08 19:44 [PATCH] powerpc/mm/radix: add missing braces for single statement block Mathieu Malaterre
@ 2018-04-08 20:34 ` Randy Dunlap
2018-04-23 19:31 ` Mathieu Malaterre
2018-04-23 19:36 ` [PATCH v2] powerpc/mm/radix: use do/while(0) trick " Mathieu Malaterre
1 sibling, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2018-04-08 20:34 UTC (permalink / raw)
To: Mathieu Malaterre, Michael Ellerman
Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev, linux-kernel
On 04/08/2018 12:44 PM, Mathieu Malaterre wrote:
> In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for
> disable_radix") an `if` statement was added for a possible empty body
> (prom_debug).
>
> Fix the following warning, treated as error with W=1:
>
> arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
> arch/powerpc/kernel/prom_init.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 5ae153b97d0a..f0e802495530 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -652,8 +652,9 @@ static void __init early_cmdline_parse(void)
> } else
> prom_radix_disable = true;
> }
> - if (prom_radix_disable)
> + if (prom_radix_disable) {
> prom_debug("Radix disabled from cmdline\n");
Looks like the macro for #prom_debug() should be fixed instead.
> + }
> }
>
> #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
>
--
~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/mm/radix: add missing braces for single statement block
2018-04-08 20:34 ` Randy Dunlap
@ 2018-04-23 19:31 ` Mathieu Malaterre
2018-04-23 19:34 ` Mathieu Malaterre
0 siblings, 1 reply; 7+ messages in thread
From: Mathieu Malaterre @ 2018-04-23 19:31 UTC (permalink / raw)
To: Randy Dunlap
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev, LKML, Joe Perches
On Sun, Apr 8, 2018 at 10:34 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
> On 04/08/2018 12:44 PM, Mathieu Malaterre wrote:
>> In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for
>> disable_radix") an `if` statement was added for a possible empty body
>> (prom_debug).
>>
>> Fix the following warning, treated as error with W=1:
>>
>> arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
>>
>> Signed-off-by: Mathieu Malaterre <malat@debian.org>
>> ---
>> arch/powerpc/kernel/prom_init.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
>> index 5ae153b97d0a..f0e802495530 100644
>> --- a/arch/powerpc/kernel/prom_init.c
>> +++ b/arch/powerpc/kernel/prom_init.c
>> @@ -652,8 +652,9 @@ static void __init early_cmdline_parse(void)
>> } else
>> prom_radix_disable = true;
>> }
>> - if (prom_radix_disable)
>> + if (prom_radix_disable) {
>> prom_debug("Radix disabled from cmdline\n");
>
> Looks like the macro for #prom_debug() should be fixed instead.
Well if I try instead:
@@ -101,9 +101,9 @@ int of_workarounds;
} while (0)
#ifdef DEBUG_PROM
-#define prom_debug(x...) prom_printf(x)
+#define prom_debug(x...) do { prom_printf(x); } while (0)
#else
-#define prom_debug(x...)
+#define prom_debug(x...) do { } while (0)
#endif
the checkpatch script returns:
WARNING: Single statement macros should not use a do {} while (0) loop
#33: FILE: arch/powerpc/kernel/prom_init.c:104:
+#define prom_debug(x...) do { prom_printf(x); } while (0)
So I suspect we cannot do much better than my original patch unfortunately.
>> + }
>> }
>>
>> #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
>>
>
>
> --
> ~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/mm/radix: add missing braces for single statement block
2018-04-23 19:31 ` Mathieu Malaterre
@ 2018-04-23 19:34 ` Mathieu Malaterre
0 siblings, 0 replies; 7+ messages in thread
From: Mathieu Malaterre @ 2018-04-23 19:34 UTC (permalink / raw)
To: Randy Dunlap
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev, LKML, Joe Perches
On Mon, Apr 23, 2018 at 9:31 PM, Mathieu Malaterre <malat@debian.org> wrote:
> On Sun, Apr 8, 2018 at 10:34 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
>> On 04/08/2018 12:44 PM, Mathieu Malaterre wrote:
>>> In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for
>>> disable_radix") an `if` statement was added for a possible empty body
>>> (prom_debug).
>>>
>>> Fix the following warning, treated as error with W=1:
>>>
>>> arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
>>>
>>> Signed-off-by: Mathieu Malaterre <malat@debian.org>
>>> ---
>>> arch/powerpc/kernel/prom_init.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
>>> index 5ae153b97d0a..f0e802495530 100644
>>> --- a/arch/powerpc/kernel/prom_init.c
>>> +++ b/arch/powerpc/kernel/prom_init.c
>>> @@ -652,8 +652,9 @@ static void __init early_cmdline_parse(void)
>>> } else
>>> prom_radix_disable = true;
>>> }
>>> - if (prom_radix_disable)
>>> + if (prom_radix_disable) {
>>> prom_debug("Radix disabled from cmdline\n");
>>
>> Looks like the macro for #prom_debug() should be fixed instead.
>
> Well if I try instead:
>
> @@ -101,9 +101,9 @@ int of_workarounds;
> } while (0)
>
> #ifdef DEBUG_PROM
> -#define prom_debug(x...) prom_printf(x)
> +#define prom_debug(x...) do { prom_printf(x); } while (0)
> #else
> -#define prom_debug(x...)
> +#define prom_debug(x...) do { } while (0)
> #endif
>
>
> the checkpatch script returns:
>
> WARNING: Single statement macros should not use a do {} while (0) loop
> #33: FILE: arch/powerpc/kernel/prom_init.c:104:
> +#define prom_debug(x...) do { prom_printf(x); } while (0)
>
>
> So I suspect we cannot do much better than my original patch unfortunately.
Right, it seems I cannot read the correct line number for a warning.
An updated patch is coming.
>>> + }
>>> }
>>>
>>> #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
>>>
>>
>>
>> --
>> ~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] powerpc/mm/radix: use do/while(0) trick for single statement block
2018-04-08 19:44 [PATCH] powerpc/mm/radix: add missing braces for single statement block Mathieu Malaterre
2018-04-08 20:34 ` Randy Dunlap
@ 2018-04-23 19:36 ` Mathieu Malaterre
2018-04-23 21:13 ` Randy Dunlap
2018-05-25 11:41 ` [v2] " Michael Ellerman
1 sibling, 2 replies; 7+ messages in thread
From: Mathieu Malaterre @ 2018-04-23 19:36 UTC (permalink / raw)
To: Michael Ellerman
Cc: Randy Dunlap, Mathieu Malaterre, Benjamin Herrenschmidt,
Paul Mackerras, linuxppc-dev, linux-kernel
In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for
disable_radix") an `if` statement was added for a possible empty body
(prom_debug).
Fix the following warning, treated as error with W=1:
arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
Suggested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
v2: update macro directly
arch/powerpc/kernel/prom_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5ae153b97d0a..7edf3aa5bc6d 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -103,7 +103,7 @@ int of_workarounds;
#ifdef DEBUG_PROM
#define prom_debug(x...) prom_printf(x)
#else
-#define prom_debug(x...)
+#define prom_debug(x...) do { } while (0)
#endif
--
2.11.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] powerpc/mm/radix: use do/while(0) trick for single statement block
2018-04-23 19:36 ` [PATCH v2] powerpc/mm/radix: use do/while(0) trick " Mathieu Malaterre
@ 2018-04-23 21:13 ` Randy Dunlap
2018-05-25 11:41 ` [v2] " Michael Ellerman
1 sibling, 0 replies; 7+ messages in thread
From: Randy Dunlap @ 2018-04-23 21:13 UTC (permalink / raw)
To: Mathieu Malaterre, Michael Ellerman
Cc: Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev, linux-kernel
On 04/23/18 12:36, Mathieu Malaterre wrote:
> In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for
> disable_radix") an `if` statement was added for a possible empty body
> (prom_debug).
>
> Fix the following warning, treated as error with W=1:
>
> arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
>
> Suggested-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
> ---
> v2: update macro directly
>
> arch/powerpc/kernel/prom_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 5ae153b97d0a..7edf3aa5bc6d 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -103,7 +103,7 @@ int of_workarounds;
> #ifdef DEBUG_PROM
> #define prom_debug(x...) prom_printf(x)
> #else
> -#define prom_debug(x...)
> +#define prom_debug(x...) do { } while (0)
> #endif
>
>
>
--
~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [v2] powerpc/mm/radix: use do/while(0) trick for single statement block
2018-04-23 19:36 ` [PATCH v2] powerpc/mm/radix: use do/while(0) trick " Mathieu Malaterre
2018-04-23 21:13 ` Randy Dunlap
@ 2018-05-25 11:41 ` Michael Ellerman
1 sibling, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2018-05-25 11:41 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Mathieu Malaterre, Randy Dunlap, linux-kernel, Paul Mackerras,
linuxppc-dev
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
On Mon, 2018-04-23 at 19:36:38 UTC, Mathieu Malaterre wrote:
> In commit 7a22d6321c3d ("powerpc/mm/radix: Update command line parsing for
> disable_radix") an `if` statement was added for a possible empty body
> (prom_debug).
>
> Fix the following warning, treated as error with W=1:
>
> arch/powerpc/kernel/prom_init.c:656:46: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
>
> Suggested-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/85aa4b98419d74dd5cc914e0893498
cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-25 11:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-08 19:44 [PATCH] powerpc/mm/radix: add missing braces for single statement block Mathieu Malaterre
2018-04-08 20:34 ` Randy Dunlap
2018-04-23 19:31 ` Mathieu Malaterre
2018-04-23 19:34 ` Mathieu Malaterre
2018-04-23 19:36 ` [PATCH v2] powerpc/mm/radix: use do/while(0) trick " Mathieu Malaterre
2018-04-23 21:13 ` Randy Dunlap
2018-05-25 11:41 ` [v2] " Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).