]> Pileus Git - ~andy/linux/commitdiff
wan: Remove unnecessary alloc/OOM messages
authorJoe Perches <joe@perches.com>
Sun, 3 Feb 2013 17:28:12 +0000 (17:28 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Feb 2013 18:22:34 +0000 (13:22 -0500)
alloc failures already get standardized OOM
messages and a dump_stack.

Hoist assigns from if tests.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wan/cosa.c
drivers/net/wan/farsync.c
drivers/net/wan/hdlc.c
drivers/net/wan/x25_asy.c

index 6aed238e573e65ffae7253dea218e7c6408d5503..0179cefae43860a18e66c38634c46c2b8fefc8b1 100644 (file)
@@ -795,8 +795,8 @@ static ssize_t cosa_read(struct file *file,
        if (mutex_lock_interruptible(&chan->rlock))
                return -ERESTARTSYS;
        
-       if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) {
-               pr_info("%s: cosa_read() - OOM\n", cosa->name);
+       chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL);
+       if (chan->rxdata == NULL) {
                mutex_unlock(&chan->rlock);
                return -ENOMEM;
        }
@@ -874,9 +874,8 @@ static ssize_t cosa_write(struct file *file,
                count = COSA_MTU;
        
        /* Allocate the buffer */
-       if ((kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA)) == NULL) {
-               pr_notice("%s: cosa_write() OOM - dropping packet\n",
-                         cosa->name);
+       kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA);
+       if (kbuf == NULL) {
                up(&chan->wsem);
                return -ENOMEM;
        }
index 56941d6547eb33388535ead21ffb808354027de2..3f0c4f268751030318dd920a2a81bf2ddd1d328d 100644 (file)
@@ -2448,11 +2448,9 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        }
 
        /* Allocate driver private data */
-       card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL);
-       if (card == NULL) {
-               pr_err("FarSync card found but insufficient memory for driver storage\n");
+       card = kzalloc(sizeof(struct fst_card_info), GFP_KERNEL);
+       if (card == NULL)
                return -ENOMEM;
-       }
 
        /* Try to enable the device */
        if ((err = pci_enable_device(pdev)) != 0) {
index 10cc7df954988efb8c7ed81f7bddaca1c4f0c213..a0a932c63d0a29e367daad9febe6ccf7f6370f3d 100644 (file)
@@ -280,14 +280,13 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
        if (!try_module_get(proto->module))
                return -ENOSYS;
 
-       if (size)
-               if ((dev_to_hdlc(dev)->state = kmalloc(size,
-                                                      GFP_KERNEL)) == NULL) {
-                       netdev_warn(dev,
-                                   "Memory squeeze on hdlc_proto_attach()\n");
+       if (size) {
+               dev_to_hdlc(dev)->state = kmalloc(size, GFP_KERNEL);
+               if (dev_to_hdlc(dev)->state == NULL) {
                        module_put(proto->module);
                        return -ENOBUFS;
                }
+       }
        dev_to_hdlc(dev)->proto = proto;
        return 0;
 }
index 44db8b75a531dd1f00a29f89651c97d496cfe881..5895f19786919f6cfb36b97273a95bc1462d1c10 100644 (file)
@@ -128,7 +128,6 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
        rbuff = kmalloc(len + 4, GFP_ATOMIC);
 
        if (xbuff == NULL || rbuff == NULL) {
-               netdev_warn(dev, "unable to grow X.25 buffers, MTU change cancelled\n");
                kfree(xbuff);
                kfree(rbuff);
                return -ENOMEM;