Commit 1634641f authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Kleber Sacilotto de Souza

isdn: avm: Fix string plus integer warning from Clang

BugLink: https://bugs.launchpad.net/bugs/1822271

[ Upstream commit 7afa81c5 ]

A recent commit in Clang expanded the -Wstring-plus-int warning, showing
some odd behavior in this file.

drivers/isdn/hardware/avm/b1.c:426:30: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
                cinfo->version[j] = "\0\0" + 1;
                                    ~~~~~~~^~~
drivers/isdn/hardware/avm/b1.c:426:30: note: use array indexing to silence this warning
                cinfo->version[j] = "\0\0" + 1;
                                           ^
                                    &      [  ]
1 warning generated.

This is equivalent to just "\0". Nick pointed out that it is smarter to
use "" instead of "\0" because "" is used elsewhere in the kernel and
can be deduplicated at the linking stage.

Link: https://github.com/ClangBuiltLinux/linux/issues/309Suggested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarJuerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 3c5193c9
...@@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo) ...@@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo)
int i, j; int i, j;
for (j = 0; j < AVM_MAXVERSION; j++) for (j = 0; j < AVM_MAXVERSION; j++)
cinfo->version[j] = "\0\0" + 1; cinfo->version[j] = "";
for (i = 0, j = 0; for (i = 0, j = 0;
j < AVM_MAXVERSION && i < cinfo->versionlen; j < AVM_MAXVERSION && i < cinfo->versionlen;
j++, i += cinfo->versionbuf[i] + 1) j++, i += cinfo->versionbuf[i] + 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment