* [PATCH] soc/tegra: Fix terminating condition
@ 2018-11-22 7:52 Nathan Chancellor
2018-11-22 8:16 ` Frank Lee
2018-11-22 8:50 ` Thierry Reding
0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2018-11-22 7:52 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter
Cc: Yangtao Li, linux-tegra, linux-kernel, Nick Desaulniers,
Nathan Chancellor
Clang warns:
drivers/soc/tegra/common.c:27:16: error: address of array
'match->compatible' will always evaluate to 'true'
[-Werror,-Wpointer-bool-conversion]
while (match->compatible) {
~~~~~ ~~~~~~~^~~~~~~~~~
1 error generated.
Whoops, we have an infinite loop and QEMU no longer boots...
https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/160242918
Check that the first character of the string isn't null so that the loop
properly terminates.
Fixes: c57eff9503a5 ("soc/tegra: refactor soc_is_tegra()")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/soc/tegra/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
index 8a538b968fe9..54627ca957e8 100644
--- a/drivers/soc/tegra/common.c
+++ b/drivers/soc/tegra/common.c
@@ -24,7 +24,7 @@ bool soc_is_tegra(void)
{
const struct of_device_id *match = tegra_machine_match;
- while (match->compatible) {
+ while (match->compatible[0]) {
if (of_machine_is_compatible(match->compatible))
return true;
--
2.20.0.rc1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] soc/tegra: Fix terminating condition
2018-11-22 7:52 [PATCH] soc/tegra: Fix terminating condition Nathan Chancellor
@ 2018-11-22 8:16 ` Frank Lee
2018-11-22 8:50 ` Thierry Reding
1 sibling, 0 replies; 4+ messages in thread
From: Frank Lee @ 2018-11-22 8:16 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Thierry Reding, jonathanh, linux-tegra, linux-kernel,
ndesaulniers
On Thu, Nov 22, 2018 at 3:53 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns:
>
> drivers/soc/tegra/common.c:27:16: error: address of array
> 'match->compatible' will always evaluate to 'true'
> [-Werror,-Wpointer-bool-conversion]
> while (match->compatible) {
> ~~~~~ ~~~~~~~^~~~~~~~~~
> 1 error generated.
>
> Whoops, we have an infinite loop and QEMU no longer boots...
>
> https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/160242918
>
> Check that the first character of the string isn't null so that the loop
> properly terminates.
>
> Fixes: c57eff9503a5 ("soc/tegra: refactor soc_is_tegra()")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/soc/tegra/common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
> index 8a538b968fe9..54627ca957e8 100644
> --- a/drivers/soc/tegra/common.c
> +++ b/drivers/soc/tegra/common.c
> @@ -24,7 +24,7 @@ bool soc_is_tegra(void)
> {
> const struct of_device_id *match = tegra_machine_match;
>
> - while (match->compatible) {
> + while (match->compatible[0]) {
How about this?
while (*match->compatible) {
:-)
Acked-by: Yangtao Li <tiny.windzz@gmail.com>
> if (of_machine_is_compatible(match->compatible))
> return true;
>
> --
> 2.20.0.rc1
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] soc/tegra: Fix terminating condition
2018-11-22 7:52 [PATCH] soc/tegra: Fix terminating condition Nathan Chancellor
2018-11-22 8:16 ` Frank Lee
@ 2018-11-22 8:50 ` Thierry Reding
2018-11-22 8:58 ` Frank Lee
1 sibling, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2018-11-22 8:50 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Jonathan Hunter, Yangtao Li, linux-tegra, linux-kernel,
Nick Desaulniers
[-- Attachment #1: Type: text/plain, Size: 943 bytes --]
On Thu, Nov 22, 2018 at 12:52:44AM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/soc/tegra/common.c:27:16: error: address of array
> 'match->compatible' will always evaluate to 'true'
> [-Werror,-Wpointer-bool-conversion]
> while (match->compatible) {
> ~~~~~ ~~~~~~~^~~~~~~~~~
> 1 error generated.
>
> Whoops, we have an infinite loop and QEMU no longer boots...
>
> https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/160242918
>
> Check that the first character of the string isn't null so that the loop
> properly terminates.
>
> Fixes: c57eff9503a5 ("soc/tegra: refactor soc_is_tegra()")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/soc/tegra/common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Wow... that's what I get from not testing this properly. Apologies for
the inconvenience.
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] soc/tegra: Fix terminating condition
2018-11-22 8:50 ` Thierry Reding
@ 2018-11-22 8:58 ` Frank Lee
0 siblings, 0 replies; 4+ messages in thread
From: Frank Lee @ 2018-11-22 8:58 UTC (permalink / raw)
To: Thierry Reding
Cc: Nathan Chancellor, jonathanh, linux-tegra, linux-kernel,
ndesaulniers
Hi Thierry:
How about change it to this?
while (*match->compatible) {
This is more beautiful. :-)
Thanks,
Yangtao
On Thu, Nov 22, 2018 at 4:50 PM Thierry Reding <thierry.reding@gmail.com> wrote:
>
> On Thu, Nov 22, 2018 at 12:52:44AM -0700, Nathan Chancellor wrote:
> > Clang warns:
> >
> > drivers/soc/tegra/common.c:27:16: error: address of array
> > 'match->compatible' will always evaluate to 'true'
> > [-Werror,-Wpointer-bool-conversion]
> > while (match->compatible) {
> > ~~~~~ ~~~~~~~^~~~~~~~~~
> > 1 error generated.
> >
> > Whoops, we have an infinite loop and QEMU no longer boots...
> >
> > https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/160242918
> >
> > Check that the first character of the string isn't null so that the loop
> > properly terminates.
> >
> > Fixes: c57eff9503a5 ("soc/tegra: refactor soc_is_tegra()")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> > drivers/soc/tegra/common.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Wow... that's what I get from not testing this properly. Apologies for
> the inconvenience.
>
> Applied, thanks.
>
> Thierry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-22 8:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-22 7:52 [PATCH] soc/tegra: Fix terminating condition Nathan Chancellor
2018-11-22 8:16 ` Frank Lee
2018-11-22 8:50 ` Thierry Reding
2018-11-22 8:58 ` Frank Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox