Commit cd228d5458186f66bc36c4884f4f26ed955c5945

Authored by Joe Perches
Committed by David S. Miller
1 parent dbb2ed2485

[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>

Showing 3 changed files with 94 additions and 93 deletions Side-by-side Diff

drivers/net/ppp_async.c
... ... @@ -160,7 +160,7 @@
160 160  
161 161 err = -ENOMEM;
162 162 ap = kzalloc(sizeof(*ap), GFP_KERNEL);
163   - if (ap == 0)
  163 + if (!ap)
164 164 goto out;
165 165  
166 166 /* initialize the asyncppp structure */
... ... @@ -215,7 +215,7 @@
215 215 ap = tty->disc_data;
216 216 tty->disc_data = NULL;
217 217 write_unlock_irq(&disc_data_lock);
218   - if (ap == 0)
  218 + if (!ap)
219 219 return;
220 220  
221 221 /*
222 222  
... ... @@ -230,10 +230,10 @@
230 230 tasklet_kill(&ap->tsk);
231 231  
232 232 ppp_unregister_channel(&ap->chan);
233   - if (ap->rpkt != 0)
  233 + if (ap->rpkt)
234 234 kfree_skb(ap->rpkt);
235 235 skb_queue_purge(&ap->rqueue);
236   - if (ap->tpkt != 0)
  236 + if (ap->tpkt)
237 237 kfree_skb(ap->tpkt);
238 238 kfree(ap);
239 239 }
240 240  
... ... @@ -285,13 +285,13 @@
285 285 int err, val;
286 286 int __user *p = (int __user *)arg;
287 287  
288   - if (ap == 0)
  288 + if (!ap)
289 289 return -ENXIO;
290 290 err = -EFAULT;
291 291 switch (cmd) {
292 292 case PPPIOCGCHAN:
293 293 err = -ENXIO;
294   - if (ap == 0)
  294 + if (!ap)
295 295 break;
296 296 err = -EFAULT;
297 297 if (put_user(ppp_channel_index(&ap->chan), p))
... ... @@ -301,7 +301,7 @@
301 301  
302 302 case PPPIOCGUNIT:
303 303 err = -ENXIO;
304   - if (ap == 0)
  304 + if (!ap)
305 305 break;
306 306 err = -EFAULT;
307 307 if (put_user(ppp_unit_number(&ap->chan), p))
... ... @@ -350,7 +350,7 @@
350 350 struct asyncppp *ap = ap_get(tty);
351 351 unsigned long flags;
352 352  
353   - if (ap == 0)
  353 + if (!ap)
354 354 return;
355 355 spin_lock_irqsave(&ap->recv_lock, flags);
356 356 ppp_async_input(ap, buf, cflags, count);
... ... @@ -369,7 +369,7 @@
369 369 struct asyncppp *ap = ap_get(tty);
370 370  
371 371 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
372   - if (ap == 0)
  372 + if (!ap)
373 373 return;
374 374 set_bit(XMIT_WAKEUP, &ap->xmit_flags);
375 375 tasklet_schedule(&ap->tsk);
... ... @@ -684,7 +684,7 @@
684 684 tty_stuffed = 1;
685 685 continue;
686 686 }
687   - if (ap->optr >= ap->olim && ap->tpkt != 0) {
  687 + if (ap->optr >= ap->olim && ap->tpkt) {
688 688 if (ppp_async_encode(ap)) {
689 689 /* finished processing ap->tpkt */
690 690 clear_bit(XMIT_FULL, &ap->xmit_flags);
... ... @@ -704,7 +704,7 @@
704 704 clear_bit(XMIT_BUSY, &ap->xmit_flags);
705 705 /* any more work to do? if not, exit the loop */
706 706 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
707   - || (!tty_stuffed && ap->tpkt != 0)))
  707 + || (!tty_stuffed && ap->tpkt)))
708 708 break;
709 709 /* more work to do, see if we can do it now */
710 710 if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags))
... ... @@ -715,7 +715,7 @@
715 715  
716 716 flush:
717 717 clear_bit(XMIT_BUSY, &ap->xmit_flags);
718   - if (ap->tpkt != 0) {
  718 + if (ap->tpkt) {
719 719 kfree_skb(ap->tpkt);
720 720 ap->tpkt = NULL;
721 721 clear_bit(XMIT_FULL, &ap->xmit_flags);
... ... @@ -848,7 +848,7 @@
848 848 s = 0;
849 849 for (i = 0; i < count; ++i) {
850 850 c = buf[i];
851   - if (flags != 0 && flags[i] != 0)
  851 + if (flags && flags[i] != 0)
852 852 continue;
853 853 s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0;
854 854 c = ((c >> 4) ^ c) & 0xf;
... ... @@ -865,7 +865,7 @@
865 865 n = scan_ordinary(ap, buf, count);
866 866  
867 867 f = 0;
868   - if (flags != 0 && (ap->state & SC_TOSS) == 0) {
  868 + if (flags && (ap->state & SC_TOSS) == 0) {
869 869 /* check the flags to see if any char had an error */
870 870 for (j = 0; j < n; ++j)
871 871 if ((f = flags[j]) != 0)
872 872  
... ... @@ -878,9 +878,9 @@
878 878 } else if (n > 0 && (ap->state & SC_TOSS) == 0) {
879 879 /* stuff the chars in the skb */
880 880 skb = ap->rpkt;
881   - if (skb == 0) {
  881 + if (!skb) {
882 882 skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2);
883   - if (skb == 0)
  883 + if (!skb)
884 884 goto nomem;
885 885 ap->rpkt = skb;
886 886 }
... ... @@ -927,7 +927,7 @@
927 927 ++n;
928 928  
929 929 buf += n;
930   - if (flags != 0)
  930 + if (flags)
931 931 flags += n;
932 932 count -= n;
933 933 }
drivers/net/ppp_generic.c
... ... @@ -367,7 +367,7 @@
367 367 struct ppp_file *pf = file->private_data;
368 368 struct ppp *ppp;
369 369  
370   - if (pf != 0) {
  370 + if (pf) {
371 371 file->private_data = NULL;
372 372 if (pf->kind == INTERFACE) {
373 373 ppp = PF_TO_PPP(pf);
... ... @@ -398,7 +398,7 @@
398 398  
399 399 ret = count;
400 400  
401   - if (pf == 0)
  401 + if (!pf)
402 402 return -ENXIO;
403 403 add_wait_queue(&pf->rwait, &wait);
404 404 for (;;) {
... ... @@ -431,7 +431,7 @@
431 431 set_current_state(TASK_RUNNING);
432 432 remove_wait_queue(&pf->rwait, &wait);
433 433  
434   - if (skb == 0)
  434 + if (!skb)
435 435 goto out;
436 436  
437 437 ret = -EOVERFLOW;
438 438  
... ... @@ -455,11 +455,11 @@
455 455 struct sk_buff *skb;
456 456 ssize_t ret;
457 457  
458   - if (pf == 0)
  458 + if (!pf)
459 459 return -ENXIO;
460 460 ret = -ENOMEM;
461 461 skb = alloc_skb(count + pf->hdrlen, GFP_KERNEL);
462   - if (skb == 0)
  462 + if (!skb)
463 463 goto out;
464 464 skb_reserve(skb, pf->hdrlen);
465 465 ret = -EFAULT;
466 466  
... ... @@ -491,11 +491,11 @@
491 491 struct ppp_file *pf = file->private_data;
492 492 unsigned int mask;
493 493  
494   - if (pf == 0)
  494 + if (!pf)
495 495 return 0;
496 496 poll_wait(file, &pf->rwait, wait);
497 497 mask = POLLOUT | POLLWRNORM;
498   - if (skb_peek(&pf->rq) != 0)
  498 + if (skb_peek(&pf->rq))
499 499 mask |= POLLIN | POLLRDNORM;
500 500 if (pf->dead)
501 501 mask |= POLLHUP;
... ... @@ -559,7 +559,7 @@
559 559 void __user *argp = (void __user *)arg;
560 560 int __user *p = argp;
561 561  
562   - if (pf == 0)
  562 + if (!pf)
563 563 return ppp_unattached_ioctl(pf, file, cmd, arg);
564 564  
565 565 if (cmd == PPPIOCDETACH) {
566 566  
... ... @@ -689,13 +689,13 @@
689 689 val &= 0xffff;
690 690 }
691 691 vj = slhc_init(val2+1, val+1);
692   - if (vj == 0) {
  692 + if (!vj) {
693 693 printk(KERN_ERR "PPP: no memory (VJ compressor)\n");
694 694 err = -ENOMEM;
695 695 break;
696 696 }
697 697 ppp_lock(ppp);
698   - if (ppp->vj != 0)
  698 + if (ppp->vj)
699 699 slhc_free(ppp->vj);
700 700 ppp->vj = vj;
701 701 ppp_unlock(ppp);
... ... @@ -786,7 +786,7 @@
786 786 if (get_user(unit, p))
787 787 break;
788 788 ppp = ppp_create_interface(unit, &err);
789   - if (ppp == 0)
  789 + if (!ppp)
790 790 break;
791 791 file->private_data = &ppp->file;
792 792 ppp->owner = file;
... ... @@ -803,7 +803,7 @@
803 803 mutex_lock(&all_ppp_mutex);
804 804 err = -ENXIO;
805 805 ppp = ppp_find_unit(unit);
806   - if (ppp != 0) {
  806 + if (ppp) {
807 807 atomic_inc(&ppp->file.refcnt);
808 808 file->private_data = &ppp->file;
809 809 err = 0;
... ... @@ -817,7 +817,7 @@
817 817 spin_lock_bh(&all_channels_lock);
818 818 err = -ENXIO;
819 819 chan = ppp_find_channel(unit);
820   - if (chan != 0) {
  820 + if (chan) {
821 821 atomic_inc(&chan->file.refcnt);
822 822 file->private_data = &chan->file;
823 823 err = 0;
824 824  
... ... @@ -946,9 +946,9 @@
946 946  
947 947 case SIOCGPPPCSTATS:
948 948 memset(&cstats, 0, sizeof(cstats));
949   - if (ppp->xc_state != 0)
  949 + if (ppp->xc_state)
950 950 ppp->xcomp->comp_stat(ppp->xc_state, &cstats.c);
951   - if (ppp->rc_state != 0)
  951 + if (ppp->rc_state)
952 952 ppp->rcomp->decomp_stat(ppp->rc_state, &cstats.d);
953 953 if (copy_to_user(addr, &cstats, sizeof(cstats)))
954 954 break;
955 955  
956 956  
... ... @@ -993,14 +993,14 @@
993 993 struct sk_buff *skb;
994 994  
995 995 ppp_xmit_lock(ppp);
996   - if (ppp->dev != 0) {
  996 + if (ppp->dev) {
997 997 ppp_push(ppp);
998   - while (ppp->xmit_pending == 0
999   - && (skb = skb_dequeue(&ppp->file.xq)) != 0)
  998 + while (!ppp->xmit_pending
  999 + && (skb = skb_dequeue(&ppp->file.xq)))
1000 1000 ppp_send_frame(ppp, skb);
1001 1001 /* If there's no work left to do, tell the core net
1002 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 1004 netif_wake_queue(ppp->dev);
1005 1005 }
1006 1006 ppp_xmit_unlock(ppp);
1007 1007  
... ... @@ -1100,12 +1100,12 @@
1100 1100  
1101 1101 switch (proto) {
1102 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 1104 break;
1105 1105 /* try to do VJ TCP header compression */
1106 1106 new_skb = alloc_skb(skb->len + ppp->dev->hard_header_len - 2,
1107 1107 GFP_ATOMIC);
1108   - if (new_skb == 0) {
  1108 + if (!new_skb) {
1109 1109 printk(KERN_ERR "PPP: no memory (VJ comp pkt)\n");
1110 1110 goto drop;
1111 1111 }
... ... @@ -1140,7 +1140,7 @@
1140 1140 }
1141 1141  
1142 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 1144 && proto != PPP_LCP && proto != PPP_CCP) {
1145 1145 if (!(ppp->flags & SC_CCP_UP) && (ppp->flags & SC_MUST_COMP)) {
1146 1146 if (net_ratelimit())
... ... @@ -1185,7 +1185,7 @@
1185 1185 struct channel *pch;
1186 1186 struct sk_buff *skb = ppp->xmit_pending;
1187 1187  
1188   - if (skb == 0)
  1188 + if (!skb)
1189 1189 return;
1190 1190  
1191 1191 list = &ppp->channels;
... ... @@ -1355,7 +1355,7 @@
1355 1355 if (flen == len && nfree == 0)
1356 1356 bits |= E;
1357 1357 frag = alloc_skb(flen + hdrlen + (flen == 0), GFP_ATOMIC);
1358   - if (frag == 0)
  1358 + if (!frag)
1359 1359 goto noskb;
1360 1360 q = skb_put(frag, flen + hdrlen);
1361 1361  
... ... @@ -1425,7 +1425,7 @@
1425 1425 struct ppp *ppp;
1426 1426  
1427 1427 spin_lock_bh(&pch->downl);
1428   - if (pch->chan != 0) {
  1428 + if (pch->chan) {
1429 1429 while (!skb_queue_empty(&pch->file.xq)) {
1430 1430 skb = skb_dequeue(&pch->file.xq);
1431 1431 if (!pch->chan->ops->start_xmit(pch->chan, skb)) {
... ... @@ -1443,7 +1443,7 @@
1443 1443 if (skb_queue_empty(&pch->file.xq)) {
1444 1444 read_lock_bh(&pch->upl);
1445 1445 ppp = pch->ppp;
1446   - if (ppp != 0)
  1446 + if (ppp)
1447 1447 ppp_xmit_process(ppp);
1448 1448 read_unlock_bh(&pch->upl);
1449 1449 }
... ... @@ -1462,7 +1462,7 @@
1462 1462 {
1463 1463 ppp_recv_lock(ppp);
1464 1464 /* ppp->dev == 0 means interface is closing down */
1465   - if (ppp->dev != 0)
  1465 + if (ppp->dev)
1466 1466 ppp_receive_frame(ppp, skb, pch);
1467 1467 else
1468 1468 kfree_skb(skb);
1469 1469  
1470 1470  
... ... @@ -1475,19 +1475,19 @@
1475 1475 struct channel *pch = chan->ppp;
1476 1476 int proto;
1477 1477  
1478   - if (pch == 0 || skb->len == 0) {
  1478 + if (!pch || skb->len == 0) {
1479 1479 kfree_skb(skb);
1480 1480 return;
1481 1481 }
1482 1482  
1483 1483 proto = PPP_PROTO(skb);
1484 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 1486 /* put it on the channel queue */
1487 1487 skb_queue_tail(&pch->file.rq, skb);
1488 1488 /* drop old frames if queue too long */
1489 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 1491 kfree_skb(skb);
1492 1492 wake_up_interruptible(&pch->file.rwait);
1493 1493 } else {
1494 1494  
1495 1495  
... ... @@ -1503,13 +1503,13 @@
1503 1503 struct channel *pch = chan->ppp;
1504 1504 struct sk_buff *skb;
1505 1505  
1506   - if (pch == 0)
  1506 + if (!pch)
1507 1507 return;
1508 1508  
1509 1509 read_lock_bh(&pch->upl);
1510   - if (pch->ppp != 0) {
  1510 + if (pch->ppp) {
1511 1511 skb = alloc_skb(0, GFP_ATOMIC);
1512   - if (skb != 0) {
  1512 + if (skb) {
1513 1513 skb->len = 0; /* probably unnecessary */
1514 1514 skb->cb[0] = code;
1515 1515 ppp_do_recv(pch->ppp, skb, pch);
... ... @@ -1548,7 +1548,7 @@
1548 1548 ppp_receive_error(struct ppp *ppp)
1549 1549 {
1550 1550 ++ppp->stats.rx_errors;
1551   - if (ppp->vj != 0)
  1551 + if (ppp->vj)
1552 1552 slhc_toss(ppp->vj);
1553 1553 }
1554 1554  
... ... @@ -1563,7 +1563,7 @@
1563 1563 * Note that some decompressors need to see uncompressed frames
1564 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 1567 && (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) == 0)
1568 1568 skb = ppp_decompress_frame(ppp, skb);
1569 1569  
1570 1570  
... ... @@ -1574,13 +1574,13 @@
1574 1574 switch (proto) {
1575 1575 case PPP_VJC_COMP:
1576 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 1578 goto err;
1579 1579  
1580 1580 if (skb_tailroom(skb) < 124 || skb_cloned(skb)) {
1581 1581 /* copy to a new sk_buff with more tailroom */
1582 1582 ns = dev_alloc_skb(skb->len + 128);
1583   - if (ns == 0) {
  1583 + if (!ns) {
1584 1584 printk(KERN_ERR"PPP: no memory (VJ decomp)\n");
1585 1585 goto err;
1586 1586 }
... ... @@ -1606,7 +1606,7 @@
1606 1606 break;
1607 1607  
1608 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 1610 goto err;
1611 1611  
1612 1612 /* Until we fix the decompressor need to make sure
... ... @@ -1636,7 +1636,7 @@
1636 1636 skb_queue_tail(&ppp->file.rq, skb);
1637 1637 /* limit queue length by dropping old frames */
1638 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 1640 kfree_skb(skb);
1641 1641 /* wake up any process polling or blocking on read */
1642 1642 wake_up_interruptible(&ppp->file.rwait);
... ... @@ -1718,7 +1718,7 @@
1718 1718 }
1719 1719  
1720 1720 ns = dev_alloc_skb(obuff_size);
1721   - if (ns == 0) {
  1721 + if (!ns) {
1722 1722 printk(KERN_ERR "ppp_decompress_frame: no memory\n");
1723 1723 goto err;
1724 1724 }
... ... @@ -1836,7 +1836,7 @@
1836 1836 ppp->minseq = ppp->mrq.next->sequence;
1837 1837  
1838 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 1840 ppp_receive_nonmp_frame(ppp, skb);
1841 1841  
1842 1842 return;
... ... @@ -2002,7 +2002,7 @@
2002 2002 struct channel *pch;
2003 2003  
2004 2004 pch = kzalloc(sizeof(struct channel), GFP_KERNEL);
2005   - if (pch == 0)
  2005 + if (!pch)
2006 2006 return -ENOMEM;
2007 2007 pch->ppp = NULL;
2008 2008 pch->chan = chan;
... ... @@ -2030,7 +2030,7 @@
2030 2030 {
2031 2031 struct channel *pch = chan->ppp;
2032 2032  
2033   - if (pch != 0)
  2033 + if (pch)
2034 2034 return pch->file.index;
2035 2035 return -1;
2036 2036 }
2037 2037  
... ... @@ -2043,9 +2043,9 @@
2043 2043 struct channel *pch = chan->ppp;
2044 2044 int unit = -1;
2045 2045  
2046   - if (pch != 0) {
  2046 + if (pch) {
2047 2047 read_lock_bh(&pch->upl);
2048   - if (pch->ppp != 0)
  2048 + if (pch->ppp)
2049 2049 unit = pch->ppp->file.index;
2050 2050 read_unlock_bh(&pch->upl);
2051 2051 }
... ... @@ -2061,7 +2061,7 @@
2061 2061 {
2062 2062 struct channel *pch = chan->ppp;
2063 2063  
2064   - if (pch == 0)
  2064 + if (!pch)
2065 2065 return; /* should never happen */
2066 2066 chan->ppp = NULL;
2067 2067  
... ... @@ -2093,7 +2093,7 @@
2093 2093 {
2094 2094 struct channel *pch = chan->ppp;
2095 2095  
2096   - if (pch == 0)
  2096 + if (!pch)
2097 2097 return;
2098 2098 ppp_channel_push(pch);
2099 2099 }
2100 2100  
2101 2101  
... ... @@ -2124,18 +2124,18 @@
2124 2124  
2125 2125 cp = find_compressor(ccp_option[0]);
2126 2126 #ifdef CONFIG_KMOD
2127   - if (cp == 0) {
  2127 + if (!cp) {
2128 2128 request_module("ppp-compress-%d", ccp_option[0]);
2129 2129 cp = find_compressor(ccp_option[0]);
2130 2130 }
2131 2131 #endif /* CONFIG_KMOD */
2132   - if (cp == 0)
  2132 + if (!cp)
2133 2133 goto out;
2134 2134  
2135 2135 err = -ENOBUFS;
2136 2136 if (data.transmit) {
2137 2137 state = cp->comp_alloc(ccp_option, data.length);
2138   - if (state != 0) {
  2138 + if (state) {
2139 2139 ppp_xmit_lock(ppp);
2140 2140 ppp->xstate &= ~SC_COMP_RUN;
2141 2141 ocomp = ppp->xcomp;
... ... @@ -2143,7 +2143,7 @@
2143 2143 ppp->xcomp = cp;
2144 2144 ppp->xc_state = state;
2145 2145 ppp_xmit_unlock(ppp);
2146   - if (ostate != 0) {
  2146 + if (ostate) {
2147 2147 ocomp->comp_free(ostate);
2148 2148 module_put(ocomp->owner);
2149 2149 }
... ... @@ -2153,7 +2153,7 @@
2153 2153  
2154 2154 } else {
2155 2155 state = cp->decomp_alloc(ccp_option, data.length);
2156   - if (state != 0) {
  2156 + if (state) {
2157 2157 ppp_recv_lock(ppp);
2158 2158 ppp->rstate &= ~SC_DECOMP_RUN;
2159 2159 ocomp = ppp->rcomp;
... ... @@ -2161,7 +2161,7 @@
2161 2161 ppp->rcomp = cp;
2162 2162 ppp->rc_state = state;
2163 2163 ppp_recv_unlock(ppp);
2164   - if (ostate != 0) {
  2164 + if (ostate) {
2165 2165 ocomp->decomp_free(ostate);
2166 2166 module_put(ocomp->owner);
2167 2167 }
... ... @@ -2228,7 +2228,7 @@
2228 2228 break;
2229 2229 if (inbound) {
2230 2230 /* we will start receiving compressed packets */
2231   - if (ppp->rc_state == 0)
  2231 + if (!ppp->rc_state)
2232 2232 break;
2233 2233 if (ppp->rcomp->decomp_init(ppp->rc_state, dp, len,
2234 2234 ppp->file.index, 0, ppp->mru, ppp->debug)) {
... ... @@ -2237,7 +2237,7 @@
2237 2237 }
2238 2238 } else {
2239 2239 /* we will soon start sending compressed packets */
2240   - if (ppp->xc_state == 0)
  2240 + if (!ppp->xc_state)
2241 2241 break;
2242 2242 if (ppp->xcomp->comp_init(ppp->xc_state, dp, len,
2243 2243 ppp->file.index, 0, ppp->debug))
2244 2244  
... ... @@ -2320,11 +2320,11 @@
2320 2320 int ret;
2321 2321 spin_lock(&compressor_list_lock);
2322 2322 ret = -EEXIST;
2323   - if (find_comp_entry(cp->compress_proto) != 0)
  2323 + if (find_comp_entry(cp->compress_proto))
2324 2324 goto out;
2325 2325 ret = -ENOMEM;
2326 2326 ce = kmalloc(sizeof(struct compressor_entry), GFP_ATOMIC);
2327   - if (ce == 0)
  2327 + if (!ce)
2328 2328 goto out;
2329 2329 ret = 0;
2330 2330 ce->comp = cp;
... ... @@ -2342,7 +2342,7 @@
2342 2342  
2343 2343 spin_lock(&compressor_list_lock);
2344 2344 ce = find_comp_entry(cp->compress_proto);
2345   - if (ce != 0 && ce->comp == cp) {
  2345 + if (ce && ce->comp == cp) {
2346 2346 list_del(&ce->list);
2347 2347 kfree(ce);
2348 2348 }
... ... @@ -2358,7 +2358,7 @@
2358 2358  
2359 2359 spin_lock(&compressor_list_lock);
2360 2360 ce = find_comp_entry(type);
2361   - if (ce != 0) {
  2361 + if (ce) {
2362 2362 cp = ce->comp;
2363 2363 if (!try_module_get(cp->owner))
2364 2364 cp = NULL;
... ... @@ -2383,7 +2383,7 @@
2383 2383 st->p.ppp_opackets = ppp->stats.tx_packets;
2384 2384 st->p.ppp_oerrors = ppp->stats.tx_errors;
2385 2385 st->p.ppp_obytes = ppp->stats.tx_bytes;
2386   - if (vj == 0)
  2386 + if (!vj)
2387 2387 return;
2388 2388 st->vj.vjs_packets = vj->sls_o_compressed + vj->sls_o_uncompressed;
2389 2389 st->vj.vjs_compressed = vj->sls_o_compressed;
2390 2390  
... ... @@ -2604,11 +2604,11 @@
2604 2604  
2605 2605 mutex_lock(&all_ppp_mutex);
2606 2606 ppp = ppp_find_unit(unit);
2607   - if (ppp == 0)
  2607 + if (!ppp)
2608 2608 goto out;
2609 2609 write_lock_bh(&pch->upl);
2610 2610 ret = -EINVAL;
2611   - if (pch->ppp != 0)
  2611 + if (pch->ppp)
2612 2612 goto outl;
2613 2613  
2614 2614 ppp_lock(ppp);
... ... @@ -2644,7 +2644,7 @@
2644 2644 ppp = pch->ppp;
2645 2645 pch->ppp = NULL;
2646 2646 write_unlock_bh(&pch->upl);
2647   - if (ppp != 0) {
  2647 + if (ppp) {
2648 2648 /* remove it from the ppp unit's list */
2649 2649 ppp_lock(ppp);
2650 2650 list_del(&pch->clist);
drivers/net/ppp_synctty.c
... ... @@ -209,7 +209,7 @@
209 209  
210 210 ap = kzalloc(sizeof(*ap), GFP_KERNEL);
211 211 err = -ENOMEM;
212   - if (ap == 0)
  212 + if (!ap)
213 213 goto out;
214 214  
215 215 /* initialize the syncppp structure */
... ... @@ -262,7 +262,7 @@
262 262 ap = tty->disc_data;
263 263 tty->disc_data = NULL;
264 264 write_unlock_irq(&disc_data_lock);
265   - if (ap == 0)
  265 + if (!ap)
266 266 return;
267 267  
268 268 /*
... ... @@ -278,7 +278,7 @@
278 278  
279 279 ppp_unregister_channel(&ap->chan);
280 280 skb_queue_purge(&ap->rqueue);
281   - if (ap->tpkt != 0)
  281 + if (ap->tpkt)
282 282 kfree_skb(ap->tpkt);
283 283 kfree(ap);
284 284 }
285 285  
... ... @@ -325,13 +325,13 @@
325 325 int __user *p = (int __user *)arg;
326 326 int err, val;
327 327  
328   - if (ap == 0)
  328 + if (!ap)
329 329 return -ENXIO;
330 330 err = -EFAULT;
331 331 switch (cmd) {
332 332 case PPPIOCGCHAN:
333 333 err = -ENXIO;
334   - if (ap == 0)
  334 + if (!ap)
335 335 break;
336 336 err = -EFAULT;
337 337 if (put_user(ppp_channel_index(&ap->chan), p))
... ... @@ -341,7 +341,7 @@
341 341  
342 342 case PPPIOCGUNIT:
343 343 err = -ENXIO;
344   - if (ap == 0)
  344 + if (!ap)
345 345 break;
346 346 err = -EFAULT;
347 347 if (put_user(ppp_unit_number(&ap->chan), p))
... ... @@ -390,7 +390,7 @@
390 390 struct syncppp *ap = sp_get(tty);
391 391 unsigned long flags;
392 392  
393   - if (ap == 0)
  393 + if (!ap)
394 394 return;
395 395 spin_lock_irqsave(&ap->recv_lock, flags);
396 396 ppp_sync_input(ap, buf, cflags, count);
... ... @@ -409,7 +409,7 @@
409 409 struct syncppp *ap = sp_get(tty);
410 410  
411 411 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
412   - if (ap == 0)
  412 + if (!ap)
413 413 return;
414 414 set_bit(XMIT_WAKEUP, &ap->xmit_flags);
415 415 tasklet_schedule(&ap->tsk);
... ... @@ -651,7 +651,7 @@
651 651 for (;;) {
652 652 if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags))
653 653 tty_stuffed = 0;
654   - if (!tty_stuffed && ap->tpkt != 0) {
  654 + if (!tty_stuffed && ap->tpkt) {
655 655 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
656 656 sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len);
657 657 if (sent < 0)
... ... @@ -669,7 +669,7 @@
669 669 /* haven't made any progress */
670 670 spin_unlock_bh(&ap->xmit_lock);
671 671 if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags)
672   - || (!tty_stuffed && ap->tpkt != 0)))
  672 + || (!tty_stuffed && ap->tpkt)))
673 673 break;
674 674 if (!spin_trylock_bh(&ap->xmit_lock))
675 675 break;
... ... @@ -677,7 +677,7 @@
677 677 return done;
678 678  
679 679 flush:
680   - if (ap->tpkt != 0) {
  680 + if (ap->tpkt) {
681 681 kfree_skb(ap->tpkt);
682 682 ap->tpkt = NULL;
683 683 clear_bit(XMIT_FULL, &ap->xmit_flags);
... ... @@ -732,7 +732,8 @@
732 732 ppp_print_buffer ("receive buffer", buf, count);
733 733  
734 734 /* stuff the chars in the skb */
735   - if ((skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2)) == 0) {
  735 + skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2);
  736 + if (!skb) {
736 737 printk(KERN_ERR "PPPsync: no memory (input pkt)\n");
737 738 goto err;
738 739 }
... ... @@ -740,7 +741,7 @@
740 741 if (buf[0] != PPP_ALLSTATIONS)
741 742 skb_reserve(skb, 2 + (buf[0] & 1));
742 743  
743   - if (flags != 0 && *flags) {
  744 + if (flags && *flags) {
744 745 /* error flag set, ignore frame */
745 746 goto err;
746 747 } else if (count > skb_tailroom(skb)) {