net: cosa: replace comparison to NULL with "!chan->rx_skb"
According to the chackpatch.pl, comparison to NULL could be written "!chan->rx_skb". Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
77282db510
commit
2076b3e61a
@ -719,7 +719,7 @@ static char *cosa_net_setup_rx(struct channel_data *chan, int size)
|
|||||||
*/
|
*/
|
||||||
kfree_skb(chan->rx_skb);
|
kfree_skb(chan->rx_skb);
|
||||||
chan->rx_skb = dev_alloc_skb(size);
|
chan->rx_skb = dev_alloc_skb(size);
|
||||||
if (chan->rx_skb == NULL) {
|
if (!chan->rx_skb) {
|
||||||
pr_notice("%s: Memory squeeze, dropping packet\n", chan->name);
|
pr_notice("%s: Memory squeeze, dropping packet\n", chan->name);
|
||||||
chan->netdev->stats.rx_dropped++;
|
chan->netdev->stats.rx_dropped++;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -783,7 +783,7 @@ static ssize_t cosa_read(struct file *file,
|
|||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
|
|
||||||
chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL);
|
chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL);
|
||||||
if (chan->rxdata == NULL) {
|
if (!chan->rxdata) {
|
||||||
mutex_unlock(&chan->rlock);
|
mutex_unlock(&chan->rlock);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@ -861,7 +861,7 @@ static ssize_t cosa_write(struct file *file,
|
|||||||
|
|
||||||
/* Allocate the buffer */
|
/* Allocate the buffer */
|
||||||
kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA);
|
kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA);
|
||||||
if (kbuf == NULL) {
|
if (!kbuf) {
|
||||||
up(&chan->wsem);
|
up(&chan->wsem);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user