aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ppp_generic.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2007-11-12 21:07:31 -0500
committerDavid S. Miller <davem@davemloft.net>2007-11-12 21:07:31 -0500
commitcd228d5458186f66bc36c4884f4f26ed955c5945 (patch)
tree4907bf4503816cc13b457250d3fae567ee627286 /drivers/net/ppp_generic.c
parentdbb2ed24851a290616d66212dc75373fd863d636 (diff)
[PPP]: Remove ptr comparisons to 0
fix sparse warnings "Using plain integer as NULL pointer" Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp_generic.c')
-rw-r--r--drivers/net/ppp_generic.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 4b49d0e8c7eb..4f690378bb77 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -367,7 +367,7 @@ static int ppp_release(struct inode *inode, struct file *file)
367 struct ppp_file *pf = file->private_data; 367 struct ppp_file *pf = file->private_data;
368 struct ppp *ppp; 368 struct ppp *ppp;
369 369
370 if (pf != 0) { 370 if (pf) {
371 file->private_data = NULL; 371 file->private_data = NULL;
372 if (pf->kind == INTERFACE) { 372 if (pf->kind == INTERFACE) {
373 ppp = PF_TO_PPP(pf); 373 ppp = PF_TO_PPP(pf);
@@ -398,7 +398,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
398 398
399 ret = count; 399 ret = count;
400 400
401 if (pf == 0) 401 if (!pf)
402 return -ENXIO; 402 return -ENXIO;
403 add_wait_queue(&pf->rwait, &wait); 403 add_wait_queue(&pf->rwait, &wait);
404 for (;;) { 404 for (;;) {
@@ -431,7 +431,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
431 set_current_state(TASK_RUNNING); 431 set_current_state(TASK_RUNNING);
432 remove_wait_queue(&pf->rwait, &wait); 432 remove_wait_queue(&pf->rwait, &wait);
433 433
434 if (skb == 0) 434 if (!skb)
435 goto out; 435 goto out;
436 436
437 ret = -EOVERFLOW; 437 ret = -EOVERFLOW;
@@ -455,11 +455,11 @@ static ssize_t ppp_write(struct file *file, const char __user *buf,
455 struct sk_buff *skb; 455 struct sk_buff *skb;
456 ssize_t ret; 456 ssize_t ret;
457 457
458 if (pf == 0) 458 if (!pf)
459 return -ENXIO; 459 return -ENXIO;
460 ret = -ENOMEM; 460 ret = -ENOMEM;
461 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL); 461 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL);
462 if (skb == 0) 462 if (!skb)
463 goto out; 463 goto out;
464 skb_reserve(skb, pf->hdrlen); 464 skb_reserve(skb, pf->hdrlen);
465 ret = -EFAULT; 465 ret = -EFAULT;
@@ -491,11 +491,11 @@ static unsigned int ppp_poll(struct file *file, poll_table *wait)
491 struct ppp_file *pf = file->private_data; 491 struct ppp_file *pf = file->private_data;
492 unsigned int mask; 492 unsigned int mask;
493 493
494 if (pf == 0) 494 if (!pf)
495 return 0; 495 return 0;
496 poll_wait(file, &pf->rwait, wait); 496 poll_wait(file, &pf->rwait, wait);
497 mask = POLLOUT | POLLWRNORM; 497 mask = POLLOUT | POLLWRNORM;
498 if (skb_peek(&pf->rq) != 0) 498 if (skb_peek(&pf->rq))
499 mask |= POLLIN | POLLRDNORM; 499 mask |= POLLIN | POLLRDNORM;
500 if (pf->dead) 500 if (pf->dead)
501 mask |= POLLHUP; 501 mask |= POLLHUP;
@@ -559,7 +559,7 @@ static int ppp_ioctl(struct inode *inode, struct file *file,
559 void __user *argp = (void __user *)arg; 559 void __user *argp = (void __user *)arg;
560 int __user *p = argp; 560 int __user *p = argp;
561 561
562 if (pf == 0) 562 if (!pf)
563 return ppp_unattached_ioctl(pf, file, cmd, arg); 563 return ppp_unattached_ioctl(pf, file, cmd, arg);
564 564
565 if (cmd == PPPIOCDETACH) { 565 if (cmd == PPPIOCDETACH) {
@@ -689,13 +689,13 @@ static int ppp_ioctl(struct inode *inode, struct file *file,
689 val &= 0xffff; 689 val &= 0xffff;
690 } 690 }
691 vj = slhc_init(val2+1, val+1); 691 vj = slhc_init(val2+1, val+1);
692 if (vj == 0) { 692 if (!vj) {
693 printk(KERN_ERR "PPP: no memory (VJ compressor)\n"); 693 printk(KERN_ERR "PPP: no memory (VJ compressor)\n");
694 err = -ENOMEM; 694 err = -ENOMEM;
695 break; 695 break;
696 } 696 }
697 ppp_lock(ppp); 697 ppp_lock(ppp);
698 if (ppp->vj != 0) 698 if (ppp->vj)
699 slhc_free(ppp->vj); 699 slhc_free(ppp->vj);
700 ppp->vj = vj; 700 ppp->vj = vj;
701 ppp_unlock(ppp); 701 ppp_unlock(ppp);
@@ -786,7 +786,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
786 if (get_user(unit, p)) 786 if (get_user(unit, p))
787 break; 787 break;
788 ppp = ppp_create_interface(unit, &err); 788 ppp = ppp_create_interface(unit, &err);
789 if (ppp == 0) 789 if (!ppp)
790 break; 790 break;
791 file->private_data = &ppp->file; 791 file->private_data = &ppp->file;
792 ppp->owner = file; 792 ppp->owner = file;
@@ -803,7 +803,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
803 mutex_lock(&all_ppp_mutex); 803 mutex_lock(&all_ppp_mutex);
804 err = -ENXIO; 804 err = -ENXIO;
805 ppp = ppp_find_unit(unit); 805 ppp = ppp_find_unit(unit);
806 if (ppp != 0) { 806 if (ppp) {
807 atomic_inc(&ppp->file.refcnt); 807 atomic_inc(&ppp->file.refcnt);
808 file->private_data = &ppp->file; 808 file->private_data = &ppp->file;
809 err = 0; 809 err = 0;
@@ -817,7 +817,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
817 spin_lock_bh(&all_channels_lock); 817 spin_lock_bh(&all_channels_lock);
818 err = -ENXIO; 818 err = -ENXIO;
819 chan = ppp_find_channel(unit); 819 chan = ppp_find_channel(unit);
820 if (chan != 0) { 820 if (chan) {
821 atomic_inc(&chan->file.refcnt); 821 atomic_inc(&chan->file.refcnt);
822 file->private_data = &chan->file; 822 file->private_data = &chan->file;
823 err = 0; 823 err = 0;
@@ -946,9 +946,9 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
946 946
947 case SIOCGPPPCSTATS: 947 case SIOCGPPPCSTATS:
948 memset(&cstats, 0, sizeof(cstats)); 948 memset(&cstats, 0, sizeof(cstats));
949 if (ppp->xc_state != 0) 949 if (ppp->xc_state)
950 ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c); 950 ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c);
951 if (ppp->rc_state != 0) 951 if (ppp->rc_state)
952 ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d); 952 ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d);
953 if (copy_to_user(addr, &cstats, sizeof(cstats))) 953 if (copy_to_user(addr, &cstats, sizeof(cstats)))
954 break; 954 break;
@@ -993,14 +993,14 @@ ppp_xmit_process(struct ppp *ppp)
993 struct sk_buff *skb; 993 struct sk_buff *skb;
994 994
995 ppp_xmit_lock(ppp); 995 ppp_xmit_lock(ppp);
996 if (ppp->dev != 0) { 996 if (ppp->dev) {
997 ppp_push(ppp); 997 ppp_push(ppp);
998 while (ppp->xmit_pending == 0 998 while (!ppp->xmit_pending
999 && (skb = skb_dequeue(&ppp->file.xq)) != 0) 999 && (skb = skb_dequeue(&ppp->file.xq)))
1000 ppp_send_frame(ppp, skb); 1000 ppp_send_frame(ppp, skb);
1001 /* If there's no work left to do, tell the core net 1001 /* If there's no work left to do, tell the core net
1002 code that we can accept some more. */ 1002 code that we can accept some more. */
1003 if (ppp->xmit_pending == 0 && skb_peek(&ppp->file.xq) == 0) 1003 if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq))
1004 netif_wake_queue(ppp->dev); 1004 netif_wake_queue(ppp->dev);
1005 } 1005 }
1006 ppp_xmit_unlock(ppp); 1006 ppp_xmit_unlock(ppp);
@@ -1100,12 +1100,12 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1100 1100
1101 switch (proto) { 1101 switch (proto) {
1102 case PPP_IP: 1102 case PPP_IP:
1103 if (ppp->vj == 0 || (ppp->flags & SC_COMP_TCP) == 0) 1103 if (!ppp->vj || (ppp->flags & SC_COMP_TCP) == 0)
1104 break; 1104 break;
1105 /* try to do VJ TCP header compression */ 1105 /* try to do VJ TCP header compression */
1106 new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2, 1106 new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2,
1107 GFP_ATOMIC); 1107 GFP_ATOMIC);
1108 if (new_skb == 0) { 1108 if (!new_skb) {
1109 printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n"); 1109 printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n");
1110 goto drop; 1110 goto drop;
1111 } 1111 }
@@ -1140,7 +1140,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
1140 } 1140 }
1141 1141
1142 /* try to do packet compression */ 1142 /* try to do packet compression */
1143 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 1143 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state
1144 && proto != PPP_LCP && proto != PPP_CCP) { 1144 && proto != PPP_LCP && proto != PPP_CCP) {
1145 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) { 1145 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) {
1146 if (net_ratelimit()) 1146 if (net_ratelimit())
@@ -1185,7 +1185,7 @@ ppp_push(struct ppp *ppp)
1185 struct channel *pch; 1185 struct channel *pch;
1186 struct sk_buff *skb = ppp->xmit_pending; 1186 struct sk_buff *skb = ppp->xmit_pending;
1187 1187
1188 if (skb == 0) 1188 if (!skb)
1189 return; 1189 return;
1190 1190
1191 list = &ppp->channels; 1191 list = &ppp->channels;
@@ -1355,7 +1355,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1355 if (flen == len && nfree == 0) 1355 if (flen == len && nfree == 0)
1356 bits |= E; 1356 bits |= E;
1357 frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC); 1357 frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC);
1358 if (frag == 0) 1358 if (!frag)
1359 goto noskb; 1359 goto noskb;
1360 q = skb_put(frag, flen + hdrlen); 1360 q = skb_put(frag, flen + hdrlen);
1361 1361
@@ -1425,7 +1425,7 @@ ppp_channel_push(struct channel *pch)
1425 struct ppp *ppp; 1425 struct ppp *ppp;
1426 1426
1427 spin_lock_bh(&pch->downl); 1427 spin_lock_bh(&pch->downl);
1428 if (pch->chan != 0) { 1428 if (pch->chan) {
1429 while (!skb_queue_empty(&pch->file.xq)) { 1429 while (!skb_queue_empty(&pch->file.xq)) {
1430 skb = skb_dequeue(&pch->file.xq); 1430 skb = skb_dequeue(&pch->file.xq);
1431 if (!pch->chan->ops->start_xmit(pch->chan, skb)) { 1431 if (!pch->chan->ops->start_xmit(pch->chan, skb)) {
@@ -1443,7 +1443,7 @@ ppp_channel_push(struct channel *pch)
1443 if (skb_queue_empty(&pch->file.xq)) { 1443 if (skb_queue_empty(&pch->file.xq)) {
1444 read_lock_bh(&pch->upl); 1444 read_lock_bh(&pch->upl);
1445 ppp = pch->ppp; 1445 ppp = pch->ppp;
1446 if (ppp != 0) 1446 if (ppp)
1447 ppp_xmit_process(ppp); 1447 ppp_xmit_process(ppp);
1448 read_unlock_bh(&pch->upl); 1448 read_unlock_bh(&pch->upl);
1449 } 1449 }
@@ -1462,7 +1462,7 @@ ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1462{ 1462{
1463 ppp_recv_lock(ppp); 1463 ppp_recv_lock(ppp);
1464 /* ppp->dev == 0 means interface is closing down */ 1464 /* ppp->dev == 0 means interface is closing down */
1465 if (ppp->dev != 0) 1465 if (ppp->dev)
1466 ppp_receive_frame(ppp, skb, pch); 1466 ppp_receive_frame(ppp, skb, pch);
1467 else 1467 else
1468 kfree_skb(skb); 1468 kfree_skb(skb);
@@ -1475,19 +1475,19 @@ ppp_input(struct ppp_channel *chan, struct sk_buff *skb)
1475 struct channel *pch = chan->ppp; 1475 struct channel *pch = chan->ppp;
1476 int proto; 1476 int proto;
1477 1477
1478 if (pch == 0 || skb->len == 0) { 1478 if (!pch || skb->len == 0) {
1479 kfree_skb(skb); 1479 kfree_skb(skb);
1480 return; 1480 return;
1481 } 1481 }
1482 1482
1483 proto = PPP_PROTO(skb); 1483 proto = PPP_PROTO(skb);
1484 read_lock_bh(&pch->upl); 1484 read_lock_bh(&pch->upl);
1485 if (pch->ppp == 0 || proto >= 0xc000 || proto == PPP_CCPFRAG) { 1485 if (!pch->ppp || proto >= 0xc000 || proto == PPP_CCPFRAG) {
1486 /* put it on the channel queue */ 1486 /* put it on the channel queue */
1487 skb_queue_tail(&pch->file.rq, skb); 1487 skb_queue_tail(&pch->file.rq, skb);
1488 /* drop old frames if queue too long */ 1488 /* drop old frames if queue too long */
1489 while (pch->file.rq.qlen > PPP_MAX_RQLEN 1489 while (pch->file.rq.qlen > PPP_MAX_RQLEN
1490 && (skb = skb_dequeue(&pch->file.rq)) != 0) 1490 && (skb = skb_dequeue(&pch->file.rq)))
1491 kfree_skb(skb); 1491 kfree_skb(skb);
1492 wake_up_interruptible(&pch->file.rwait); 1492 wake_up_interruptible(&pch->file.rwait);
1493 } else { 1493 } else {
@@ -1503,13 +1503,13 @@ ppp_input_error(struct ppp_channel *chan, int code)
1503 struct channel *pch = chan->ppp; 1503 struct channel *pch = chan->ppp;
1504 struct sk_buff *skb; 1504 struct sk_buff *skb;
1505 1505
1506 if (pch == 0) 1506 if (!pch)
1507 return; 1507 return;
1508 1508
1509 read_lock_bh(&pch->upl); 1509 read_lock_bh(&pch->upl);
1510 if (pch->ppp != 0) { 1510 if (pch->ppp) {
1511 skb = alloc_skb(0, GFP_ATOMIC); 1511 skb = alloc_skb(0, GFP_ATOMIC);
1512 if (skb != 0) { 1512 if (skb) {
1513 skb->len = 0; /* probably unnecessary */ 1513 skb->len = 0; /* probably unnecessary */
1514 skb->cb[0] = code; 1514 skb->cb[0] = code;
1515 ppp_do_recv(pch->ppp, skb, pch); 1515 ppp_do_recv(pch->ppp, skb, pch);
@@ -1548,7 +1548,7 @@ static void
1548ppp_receive_error(struct ppp *ppp) 1548ppp_receive_error(struct ppp *ppp)
1549{ 1549{
1550 ++ppp->stats.rx_errors; 1550 ++ppp->stats.rx_errors;
1551 if (ppp->vj != 0) 1551 if (ppp->vj)
1552 slhc_toss(ppp->vj); 1552 slhc_toss(ppp->vj);
1553} 1553}
1554 1554
@@ -1563,7 +1563,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1563 * Note that some decompressors need to see uncompressed frames 1563 * Note that some decompressors need to see uncompressed frames
1564 * that come in as well as compressed frames. 1564 * that come in as well as compressed frames.
1565 */ 1565 */
1566 if (ppp->rc_state != 0 && (ppp->rstate & SC_DECOMP_RUN) 1566 if (ppp->rc_state && (ppp->rstate & SC_DECOMP_RUN)
1567 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0) 1567 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0)
1568 skb = ppp_decompress_frame(ppp, skb); 1568 skb = ppp_decompress_frame(ppp, skb);
1569 1569
@@ -1574,13 +1574,13 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1574 switch (proto) { 1574 switch (proto) {
1575 case PPP_VJC_COMP: 1575 case PPP_VJC_COMP:
1576 /* decompress VJ compressed packets */ 1576 /* decompress VJ compressed packets */
1577 if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) 1577 if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP))
1578 goto err; 1578 goto err;
1579 1579
1580 if (skb_tailroom(skb) < 124 || skb_cloned(skb)) { 1580 if (skb_tailroom(skb) < 124 || skb_cloned(skb)) {
1581 /* copy to a new sk_buff with more tailroom */ 1581 /* copy to a new sk_buff with more tailroom */
1582 ns = dev_alloc_skb(skb->len + 128); 1582 ns = dev_alloc_skb(skb->len + 128);
1583 if (ns == 0) { 1583 if (!ns) {
1584 printk(KERN_ERR"PPP: no memory (VJ decomp)\n"); 1584 printk(KERN_ERR"PPP: no memory (VJ decomp)\n");
1585 goto err; 1585 goto err;
1586 } 1586 }
@@ -1606,7 +1606,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1606 break; 1606 break;
1607 1607
1608 case PPP_VJC_UNCOMP: 1608 case PPP_VJC_UNCOMP:
1609 if (ppp->vj == 0 || (ppp->flags & SC_REJ_COMP_TCP)) 1609 if (!ppp->vj || (ppp->flags & SC_REJ_COMP_TCP))
1610 goto err; 1610 goto err;
1611 1611
1612 /* Until we fix the decompressor need to make sure 1612 /* Until we fix the decompressor need to make sure
@@ -1636,7 +1636,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
1636 skb_queue_tail(&ppp->file.rq, skb); 1636 skb_queue_tail(&ppp->file.rq, skb);
1637 /* limit queue length by dropping old frames */ 1637 /* limit queue length by dropping old frames */
1638 while (ppp->file.rq.qlen > PPP_MAX_RQLEN 1638 while (ppp->file.rq.qlen > PPP_MAX_RQLEN
1639 && (skb = skb_dequeue(&ppp->file.rq)) != 0) 1639 && (skb = skb_dequeue(&ppp->file.rq)))
1640 kfree_skb(skb); 1640 kfree_skb(skb);
1641 /* wake up any process polling or blocking on read */ 1641 /* wake up any process polling or blocking on read */
1642 wake_up_interruptible(&ppp->file.rwait); 1642 wake_up_interruptible(&ppp->file.rwait);
@@ -1718,7 +1718,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
1718 } 1718 }
1719 1719
1720 ns = dev_alloc_skb(obuff_size); 1720 ns = dev_alloc_skb(obuff_size);
1721 if (ns == 0) { 1721 if (!ns) {
1722 printk(KERN_ERR "ppp_decompress_frame: no memory\n"); 1722 printk(KERN_ERR "ppp_decompress_frame: no memory\n");
1723 goto err; 1723 goto err;
1724 } 1724 }
@@ -1836,7 +1836,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1836 ppp->minseq = ppp->mrq.next->sequence; 1836 ppp->minseq = ppp->mrq.next->sequence;
1837 1837
1838 /* Pull completed packets off the queue and receive them. */ 1838 /* Pull completed packets off the queue and receive them. */
1839 while ((skb = ppp_mp_reconstruct(ppp)) != 0) 1839 while ((skb = ppp_mp_reconstruct(ppp)))
1840 ppp_receive_nonmp_frame(ppp, skb); 1840 ppp_receive_nonmp_frame(ppp, skb);
1841 1841
1842 return; 1842 return;
@@ -2002,7 +2002,7 @@ ppp_register_channel(struct ppp_channel *chan)
2002 struct channel *pch; 2002 struct channel *pch;
2003 2003
2004 pch = kzalloc(sizeof(struct channel), GFP_KERNEL); 2004 pch = kzalloc(sizeof(struct channel), GFP_KERNEL);
2005 if (pch == 0) 2005 if (!pch)
2006 return -ENOMEM; 2006 return -ENOMEM;
2007 pch->ppp = NULL; 2007 pch->ppp = NULL;
2008 pch->chan = chan; 2008 pch->chan = chan;
@@ -2030,7 +2030,7 @@ int ppp_channel_index(struct ppp_channel *chan)
2030{ 2030{
2031 struct channel *pch = chan->ppp; 2031 struct channel *pch = chan->ppp;
2032 2032
2033 if (pch != 0) 2033 if (pch)
2034 return pch->file.index; 2034 return pch->file.index;
2035 return -1; 2035 return -1;
2036} 2036}
@@ -2043,9 +2043,9 @@ int ppp_unit_number(struct ppp_channel *chan)
2043 struct channel *pch = chan->ppp; 2043 struct channel *pch = chan->ppp;
2044 int unit = -1; 2044 int unit = -1;
2045 2045
2046 if (pch != 0) { 2046 if (pch) {
2047 read_lock_bh(&pch->upl); 2047 read_lock_bh(&pch->upl);
2048 if (pch->ppp != 0) 2048 if (pch->ppp)
2049 unit = pch->ppp->file.index; 2049 unit = pch->ppp->file.index;
2050 read_unlock_bh(&pch->upl); 2050 read_unlock_bh(&pch->upl);
2051 } 2051 }
@@ -2061,7 +2061,7 @@ ppp_unregister_channel(struct ppp_channel *chan)
2061{ 2061{
2062 struct channel *pch = chan->ppp; 2062 struct channel *pch = chan->ppp;
2063 2063
2064 if (pch == 0) 2064 if (!pch)
2065 return; /* should never happen */ 2065 return; /* should never happen */
2066 chan->ppp = NULL; 2066 chan->ppp = NULL;
2067 2067
@@ -2093,7 +2093,7 @@ ppp_output_wakeup(struct ppp_channel *chan)
2093{ 2093{
2094 struct channel *pch = chan->ppp; 2094 struct channel *pch = chan->ppp;
2095 2095
2096 if (pch == 0) 2096 if (!pch)
2097 return; 2097 return;
2098 ppp_channel_push(pch); 2098 ppp_channel_push(pch);
2099} 2099}
@@ -2124,18 +2124,18 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2124 2124
2125 cp = find_compressor(ccp_option[0]); 2125 cp = find_compressor(ccp_option[0]);
2126#ifdef CONFIG_KMOD 2126#ifdef CONFIG_KMOD
2127 if (cp == 0) { 2127 if (!cp) {
2128 request_module("ppp-compress-%d", ccp_option[0]); 2128 request_module("ppp-compress-%d", ccp_option[0]);
2129 cp = find_compressor(ccp_option[0]); 2129 cp = find_compressor(ccp_option[0]);
2130 } 2130 }
2131#endif /* CONFIG_KMOD */ 2131#endif /* CONFIG_KMOD */
2132 if (cp == 0) 2132 if (!cp)
2133 goto out; 2133 goto out;
2134 2134
2135 err = -ENOBUFS; 2135 err = -ENOBUFS;
2136 if (data.transmit) { 2136 if (data.transmit) {
2137 state = cp->comp_alloc(ccp_option, data.length); 2137 state = cp->comp_alloc(ccp_option, data.length);
2138 if (state != 0) { 2138 if (state) {
2139 ppp_xmit_lock(ppp); 2139 ppp_xmit_lock(ppp);
2140 ppp->xstate &= ~SC_COMP_RUN; 2140 ppp->xstate &= ~SC_COMP_RUN;
2141 ocomp = ppp->xcomp; 2141 ocomp = ppp->xcomp;
@@ -2143,7 +2143,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2143 ppp->xcomp = cp; 2143 ppp->xcomp = cp;
2144 ppp->xc_state = state; 2144 ppp->xc_state = state;
2145 ppp_xmit_unlock(ppp); 2145 ppp_xmit_unlock(ppp);
2146 if (ostate != 0) { 2146 if (ostate) {
2147 ocomp->comp_free(ostate); 2147 ocomp->comp_free(ostate);
2148 module_put(ocomp->owner); 2148 module_put(ocomp->owner);
2149 } 2149 }
@@ -2153,7 +2153,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2153 2153
2154 } else { 2154 } else {
2155 state = cp->decomp_alloc(ccp_option, data.length); 2155 state = cp->decomp_alloc(ccp_option, data.length);
2156 if (state != 0) { 2156 if (state) {
2157 ppp_recv_lock(ppp); 2157 ppp_recv_lock(ppp);
2158 ppp->rstate &= ~SC_DECOMP_RUN; 2158 ppp->rstate &= ~SC_DECOMP_RUN;
2159 ocomp = ppp->rcomp; 2159 ocomp = ppp->rcomp;
@@ -2161,7 +2161,7 @@ ppp_set_compress(struct ppp *ppp, unsigned long arg)
2161 ppp->rcomp = cp; 2161 ppp->rcomp = cp;
2162 ppp->rc_state = state; 2162 ppp->rc_state = state;
2163 ppp_recv_unlock(ppp); 2163 ppp_recv_unlock(ppp);
2164 if (ostate != 0) { 2164 if (ostate) {
2165 ocomp->decomp_free(ostate); 2165 ocomp->decomp_free(ostate);
2166 module_put(ocomp->owner); 2166 module_put(ocomp->owner);
2167 } 2167 }
@@ -2228,7 +2228,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
2228 break; 2228 break;
2229 if (inbound) { 2229 if (inbound) {
2230 /* we will start receiving compressed packets */ 2230 /* we will start receiving compressed packets */
2231 if (ppp->rc_state == 0) 2231 if (!ppp->rc_state)
2232 break; 2232 break;
2233 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len, 2233 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len,
2234 ppp->file.index, 0, ppp->mru, ppp->debug)) { 2234 ppp->file.index, 0, ppp->mru, ppp->debug)) {
@@ -2237,7 +2237,7 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
2237 } 2237 }
2238 } else { 2238 } else {
2239 /* we will soon start sending compressed packets */ 2239 /* we will soon start sending compressed packets */
2240 if (ppp->xc_state == 0) 2240 if (!ppp->xc_state)
2241 break; 2241 break;
2242 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len, 2242 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len,
2243 ppp->file.index, 0, ppp->debug)) 2243 ppp->file.index, 0, ppp->debug))
@@ -2320,11 +2320,11 @@ ppp_register_compressor(struct compressor *cp)
2320 int ret; 2320 int ret;
2321 spin_lock(&compressor_list_lock); 2321 spin_lock(&compressor_list_lock);
2322 ret = -EEXIST; 2322 ret = -EEXIST;
2323 if (find_comp_entry(cp->compress_proto) != 0) 2323 if (find_comp_entry(cp->compress_proto))
2324 goto out; 2324 goto out;
2325 ret = -ENOMEM; 2325 ret = -ENOMEM;
2326 ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC); 2326 ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC);
2327 if (ce == 0) 2327 if (!ce)
2328 goto out; 2328 goto out;
2329 ret = 0; 2329 ret = 0;
2330 ce->comp = cp; 2330 ce->comp = cp;
@@ -2342,7 +2342,7 @@ ppp_unregister_compressor(struct compressor *cp)
2342 2342
2343 spin_lock(&compressor_list_lock); 2343 spin_lock(&compressor_list_lock);
2344 ce = find_comp_entry(cp->compress_proto); 2344 ce = find_comp_entry(cp->compress_proto);
2345 if (ce != 0 && ce->comp == cp) { 2345 if (ce && ce->comp == cp) {
2346 list_del(&ce->list); 2346 list_del(&ce->list);
2347 kfree(ce); 2347 kfree(ce);
2348 } 2348 }
@@ -2358,7 +2358,7 @@ find_compressor(int type)
2358 2358
2359 spin_lock(&compressor_list_lock); 2359 spin_lock(&compressor_list_lock);
2360 ce = find_comp_entry(type); 2360 ce = find_comp_entry(type);
2361 if (ce != 0) { 2361 if (ce) {
2362 cp = ce->comp; 2362 cp = ce->comp;
2363 if (!try_module_get(cp->owner)) 2363 if (!try_module_get(cp->owner))
2364 cp = NULL; 2364 cp = NULL;
@@ -2383,7 +2383,7 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st)
2383 st->p.ppp_opackets = ppp->stats.tx_packets; 2383 st->p.ppp_opackets = ppp->stats.tx_packets;
2384 st->p.ppp_oerrors = ppp->stats.tx_errors; 2384 st->p.ppp_oerrors = ppp->stats.tx_errors;
2385 st->p.ppp_obytes = ppp->stats.tx_bytes; 2385 st->p.ppp_obytes = ppp->stats.tx_bytes;
2386 if (vj == 0) 2386 if (!vj)
2387 return; 2387 return;
2388 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed; 2388 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed;
2389 st->vj.vjs_compressed = vj->sls_o_compressed; 2389 st->vj.vjs_compressed = vj->sls_o_compressed;
@@ -2604,11 +2604,11 @@ ppp_connect_channel(struct channel *pch, int unit)
2604 2604
2605 mutex_lock(&all_ppp_mutex); 2605 mutex_lock(&all_ppp_mutex);
2606 ppp = ppp_find_unit(unit); 2606 ppp = ppp_find_unit(unit);
2607 if (ppp == 0) 2607 if (!ppp)
2608 goto out; 2608 goto out;
2609 write_lock_bh(&pch->upl); 2609 write_lock_bh(&pch->upl);
2610 ret = -EINVAL; 2610 ret = -EINVAL;
2611 if (pch->ppp != 0) 2611 if (pch->ppp)
2612 goto outl; 2612 goto outl;
2613 2613
2614 ppp_lock(ppp); 2614 ppp_lock(ppp);
@@ -2644,7 +2644,7 @@ ppp_disconnect_channel(struct channel *pch)
2644 ppp = pch->ppp; 2644 ppp = pch->ppp;
2645 pch->ppp = NULL; 2645 pch->ppp = NULL;
2646 write_unlock_bh(&pch->upl); 2646 write_unlock_bh(&pch->upl);
2647 if (ppp != 0) { 2647 if (ppp) {
2648 /* remove it from the ppp unit's list */ 2648 /* remove it from the ppp unit's list */
2649 ppp_lock(ppp); 2649 ppp_lock(ppp);
2650 list_del(&pch->clist); 2650 list_del(&pch->clist);