[v2,3/3] Constify some function parameters
diff mbox

Message ID 20160705014315.c44b7c41fcb6900e10d9f4a2@gmail.com
State New
Headers show

Commit Message

Emese Revfy July 4, 2016, 11:43 p.m. UTC
Initify needs const pointer types, the initify plugin caught some __printf
arguments that weren't const yet.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
---
 drivers/isdn/hisax/config.c | 4 ++--
 drivers/isdn/hisax/hisax.h  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

kernel test robot July 4, 2016, 11:58 p.m. UTC | #1
Hi,

[auto build test WARNING on next-20160704]
[cannot apply to tip/x86/core asm-generic/master v4.7-rc6 v4.7-rc5 v4.7-rc4 v4.7-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Emese-Revfy/Introduce-the-initify-gcc-plugin/20160705-074117
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
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=sparc64 

All warnings (new ones prefixed by >>):

   drivers/isdn/hisax/config.c: In function 'VHiSax_putstatus':
>> drivers/isdn/hisax/config.c:688:5: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
      p = fmt;
        ^

vim +/const +688 drivers/isdn/hisax/config.c

^1da177e Linus Torvalds 2005-04-16  672  
^1da177e Linus Torvalds 2005-04-16  673  	if (!cs) {
^1da177e Linus Torvalds 2005-04-16  674  		printk(KERN_WARNING "HiSax: No CardStatus for message");
^1da177e Linus Torvalds 2005-04-16  675  		return;
^1da177e Linus Torvalds 2005-04-16  676  	}
^1da177e Linus Torvalds 2005-04-16  677  	spin_lock_irqsave(&cs->statlock, flags);
^1da177e Linus Torvalds 2005-04-16  678  	p = tmpbuf;
^1da177e Linus Torvalds 2005-04-16  679  	if (head) {
^1da177e Linus Torvalds 2005-04-16  680  		p += jiftime(p, jiffies);
^1da177e Linus Torvalds 2005-04-16  681  		p += sprintf(p, " %s", head);
^1da177e Linus Torvalds 2005-04-16  682  		p += vsprintf(p, fmt, args);
^1da177e Linus Torvalds 2005-04-16  683  		*p++ = '\n';
^1da177e Linus Torvalds 2005-04-16  684  		*p = 0;
^1da177e Linus Torvalds 2005-04-16  685  		len = p - tmpbuf;
^1da177e Linus Torvalds 2005-04-16  686  		p = tmpbuf;
^1da177e Linus Torvalds 2005-04-16  687  	} else {
^1da177e Linus Torvalds 2005-04-16 @688  		p = fmt;
^1da177e Linus Torvalds 2005-04-16  689  		len = strlen(fmt);
^1da177e Linus Torvalds 2005-04-16  690  	}
^1da177e Linus Torvalds 2005-04-16  691  	if (len > HISAX_STATUS_BUFSIZE) {
^1da177e Linus Torvalds 2005-04-16  692  		spin_unlock_irqrestore(&cs->statlock, flags);
^1da177e Linus Torvalds 2005-04-16  693  		printk(KERN_WARNING "HiSax: status overflow %d/%d\n",
^1da177e Linus Torvalds 2005-04-16  694  		       len, HISAX_STATUS_BUFSIZE);
^1da177e Linus Torvalds 2005-04-16  695  		return;
^1da177e Linus Torvalds 2005-04-16  696  	}

:::::: The code at line 688 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Emese Revfy July 6, 2016, 4:45 p.m. UTC | #2
On Tue, 5 Jul 2016 07:58:04 +0800
kbuild test robot <lkp@intel.com> wrote:

> All warnings (new ones prefixed by >>):
> 
>    drivers/isdn/hisax/config.c: In function 'VHiSax_putstatus':
> >> drivers/isdn/hisax/config.c:688:5: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>       p = fmt;

Hi,

Thanks for the report, I resent "[PATCH v2 3/3] Constify some function parameters" with the fix.

Patch
diff mbox

diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index bf04d2a..a7d53c9 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -659,7 +659,7 @@  int jiftime(char *s, long mark)
 
 static u_char tmpbuf[HISAX_STATUS_BUFSIZE];
 
-void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt,
+void VHiSax_putstatus(struct IsdnCardState *cs, char *head, const char *fmt,
 		      va_list args)
 {
 	/* if head == NULL the fmt contains the full info */
@@ -729,7 +729,7 @@  void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt,
 	}
 }
 
-void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...)
+void HiSax_putstatus(struct IsdnCardState *cs, char *head, const char *fmt, ...)
 {
 	va_list args;
 
diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h
index 6ead6314..338d040 100644
--- a/drivers/isdn/hisax/hisax.h
+++ b/drivers/isdn/hisax/hisax.h
@@ -1288,9 +1288,9 @@  int jiftime(char *s, long mark);
 int HiSax_command(isdn_ctrl *ic);
 int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb);
 __printf(3, 4)
-void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...);
+void HiSax_putstatus(struct IsdnCardState *cs, char *head, const char *fmt, ...);
 __printf(3, 0)
-void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args);
+void VHiSax_putstatus(struct IsdnCardState *cs, char *head, const char *fmt, va_list args);
 void HiSax_reportcard(int cardnr, int sel);
 int QuickHex(char *txt, u_char *p, int cnt);
 void LogFrame(struct IsdnCardState *cs, u_char *p, int size);