Commit 1d5d1fdc authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

wan: Remove unnecessary alloc/OOM messages

alloc failures already get standardized OOM
messages and a dump_stack.

Hoist assigns from if tests.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38673c82
...@@ -795,8 +795,8 @@ static ssize_t cosa_read(struct file *file, ...@@ -795,8 +795,8 @@ static ssize_t cosa_read(struct file *file,
if (mutex_lock_interruptible(&chan->rlock)) if (mutex_lock_interruptible(&chan->rlock))
return -ERESTARTSYS; return -ERESTARTSYS;
if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) { chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL);
pr_info("%s: cosa_read() - OOM\n", cosa->name); if (chan->rxdata == NULL) {
mutex_unlock(&chan->rlock); mutex_unlock(&chan->rlock);
return -ENOMEM; return -ENOMEM;
} }
...@@ -874,9 +874,8 @@ static ssize_t cosa_write(struct file *file, ...@@ -874,9 +874,8 @@ static ssize_t cosa_write(struct file *file,
count = COSA_MTU; count = COSA_MTU;
/* Allocate the buffer */ /* Allocate the buffer */
if ((kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA)) == NULL) { kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA);
pr_notice("%s: cosa_write() OOM - dropping packet\n", if (kbuf == NULL) {
cosa->name);
up(&chan->wsem); up(&chan->wsem);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -2448,11 +2448,9 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2448,11 +2448,9 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
/* Allocate driver private data */ /* Allocate driver private data */
card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL); card = kzalloc(sizeof(struct fst_card_info), GFP_KERNEL);
if (card == NULL) { if (card == NULL)
pr_err("FarSync card found but insufficient memory for driver storage\n");
return -ENOMEM; return -ENOMEM;
}
/* Try to enable the device */ /* Try to enable the device */
if ((err = pci_enable_device(pdev)) != 0) { if ((err = pci_enable_device(pdev)) != 0) {
......
...@@ -280,14 +280,13 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, ...@@ -280,14 +280,13 @@ int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
if (!try_module_get(proto->module)) if (!try_module_get(proto->module))
return -ENOSYS; return -ENOSYS;
if (size) if (size) {
if ((dev_to_hdlc(dev)->state = kmalloc(size, dev_to_hdlc(dev)->state = kmalloc(size, GFP_KERNEL);
GFP_KERNEL)) == NULL) { if (dev_to_hdlc(dev)->state == NULL) {
netdev_warn(dev,
"Memory squeeze on hdlc_proto_attach()\n");
module_put(proto->module); module_put(proto->module);
return -ENOBUFS; return -ENOBUFS;
} }
}
dev_to_hdlc(dev)->proto = proto; dev_to_hdlc(dev)->proto = proto;
return 0; return 0;
} }
......
...@@ -128,7 +128,6 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu) ...@@ -128,7 +128,6 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
rbuff = kmalloc(len + 4, GFP_ATOMIC); rbuff = kmalloc(len + 4, GFP_ATOMIC);
if (xbuff == NULL || rbuff == NULL) { if (xbuff == NULL || rbuff == NULL) {
netdev_warn(dev, "unable to grow X.25 buffers, MTU change cancelled\n");
kfree(xbuff); kfree(xbuff);
kfree(rbuff); kfree(rbuff);
return -ENOMEM; return -ENOMEM;
......
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