Re: [PATCH 2/4] atm: idt77252: Delete an error message for a failed memory allocation in seven functions

2017-08-06 Thread kbuild test robot
Hi Markus,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.13-rc3 next-20170804]
[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/SF-Markus-Elfring/atm-idt77252-Adjust-four-function-calls-together-with-a-variable-assignment/20170806-081417
config: x86_64-randconfig-b0-08070032 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers//atm/idt77252.c: In function 'idt77252_send_oam':
>> drivers//atm/idt77252.c:2003: warning: unused variable 'card'

vim +/card +2003 drivers//atm/idt77252.c

^1da177e Linus Torvalds   2005-04-16  1998  
^1da177e Linus Torvalds   2005-04-16  1999  static int
^1da177e Linus Torvalds   2005-04-16  2000  idt77252_send_oam(struct atm_vcc 
*vcc, void *cell, int flags)
^1da177e Linus Torvalds   2005-04-16  2001  {
^1da177e Linus Torvalds   2005-04-16  2002  struct atm_dev *dev = vcc->dev;
^1da177e Linus Torvalds   2005-04-16 @2003  struct idt77252_dev *card = 
dev->dev_data;
^1da177e Linus Torvalds   2005-04-16  2004  struct sk_buff *skb;
^1da177e Linus Torvalds   2005-04-16  2005  
^1da177e Linus Torvalds   2005-04-16  2006  skb = dev_alloc_skb(64);
^1da177e Linus Torvalds   2005-04-16  2007  if (!skb) {
^1da177e Linus Torvalds   2005-04-16  2008  
atomic_inc(>stats->tx_err);
^1da177e Linus Torvalds   2005-04-16  2009  return -ENOMEM;
^1da177e Linus Torvalds   2005-04-16  2010  }
14afee4b Reshetova, Elena 2017-06-30  2011  refcount_add(skb->truesize, 
_atm(vcc)->sk_wmem_alloc);
^1da177e Linus Torvalds   2005-04-16  2012  
59ae1d12 Johannes Berg2017-06-16  2013  skb_put_data(skb, cell, 52);
^1da177e Linus Torvalds   2005-04-16  2014  
^1da177e Linus Torvalds   2005-04-16  2015  return idt77252_send_skb(vcc, 
skb, 1);
^1da177e Linus Torvalds   2005-04-16  2016  }
^1da177e Linus Torvalds   2005-04-16  2017  

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

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH 2/4] atm: idt77252: Delete an error message for a failed memory allocation in seven functions

2017-08-05 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 5 Aug 2017 12:45:34 +0200

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring 
---
 drivers/atm/idt77252.c | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 6a051f5909d0..434dc4ee5f15 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -1307,8 +1307,6 @@ idt77252_rx_raw(struct idt77252_dev *card)

sb = dev_alloc_skb(64);
if (!sb) {
-   printk("%s: Can't allocate buffers for AAL0.\n",
-  card->name);
atomic_inc(>stats->rx_err);
goto drop;
}
@@ -2007,7 +2005,6 @@ idt77252_send_oam(struct atm_vcc *vcc, void *cell, int 
flags)
 
skb = dev_alloc_skb(64);
if (!skb) {
-   printk("%s: Out of memory in send_oam().\n", card->name);
atomic_inc(>stats->tx_err);
return -ENOMEM;
}
@@ -2427,7 +2424,6 @@ idt77252_open(struct atm_vcc *vcc)
if (!card->vcs[index]) {
card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
if (!card->vcs[index]) {
-   printk("%s: can't alloc vc in open()\n", card->name);
mutex_unlock(>mutex);
return -ENOMEM;
}
@@ -2857,10 +2853,9 @@ open_card_oam(struct idt77252_dev *card)
index = VPCI2VC(card, vpi, vci);
 
vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
-   if (!vc) {
-   printk("%s: can't alloc vc\n", card->name);
+   if (!vc)
return -ENOMEM;
-   }
+
vc->index = index;
card->vcs[index] = vc;
 
@@ -2924,10 +2919,9 @@ open_card_ubr0(struct idt77252_dev *card)
struct vc_map *vc;
 
vc = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
-   if (!vc) {
-   printk("%s: can't alloc vc\n", card->name);
+   if (!vc)
return -ENOMEM;
-   }
+
card->vcs[0] = vc;
vc->class = SCHED_UBR0;
 
@@ -3410,7 +3404,6 @@ static int init_card(struct atm_dev *dev)
IPRINTK("%s: allocate %d byte for VC map.\n", card->name, size);
card->vcs = vzalloc(size);
if (!card->vcs) {
-   printk("%s: memory allocation failure.\n", card->name);
deinit_card(card);
return -1;
}
@@ -3420,7 +3413,6 @@ static int init_card(struct atm_dev *dev)
card->name, size);
card->scd2vc = vzalloc(size);
if (!card->scd2vc) {
-   printk("%s: memory allocation failure.\n", card->name);
deinit_card(card);
return -1;
}
@@ -3430,7 +3422,6 @@ static int init_card(struct atm_dev *dev)
card->name, size);
card->soft_tst = vmalloc(size);
if (!card->soft_tst) {
-   printk("%s: memory allocation failure.\n", card->name);
deinit_card(card);
return -1;
}
@@ -3616,7 +3607,6 @@ static int idt77252_init_one(struct pci_dev *pcidev,
 
card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL);
if (!card) {
-   printk("idt77252-%d: can't allocate private data\n", index);
err = -ENOMEM;
goto err_out_disable_pdev;
}
-- 
2.13.4