linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] isdn: avm: Fix string plus integer warning from Clang
@ 2019-01-08  5:06 Nathan Chancellor
  2019-01-08 17:50 ` Nick Desaulniers
  2019-01-10  5:41 ` [PATCH v2] " Nathan Chancellor
  0 siblings, 2 replies; 6+ messages in thread
From: Nathan Chancellor @ 2019-01-08  5:06 UTC (permalink / raw)
  To: Karsten Keil, David S. Miller
  Cc: netdev, linux-kernel, Nick Desaulniers, Nathan Chancellor

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" so fix it to clean up the warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/309
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/isdn/hardware/avm/b1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
index 4ac378e48902..7fa8141e2019 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo)
 	int i, j;
 
 	for (j = 0; j < AVM_MAXVERSION; j++)
-		cinfo->version[j] = "\0\0" + 1;
+		cinfo->version[j] = "\0";
 	for (i = 0, j = 0;
 	     j < AVM_MAXVERSION && i < cinfo->versionlen;
 	     j++, i += cinfo->versionbuf[i] + 1)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-19 18:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08  5:06 [PATCH] isdn: avm: Fix string plus integer warning from Clang Nathan Chancellor
2019-01-08 17:50 ` Nick Desaulniers
2019-01-08 17:54   ` Nathan Chancellor
2019-01-10  5:41 ` [PATCH v2] " Nathan Chancellor
2019-01-10 18:57   ` Nick Desaulniers
2019-01-19 18:02   ` David Miller

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).