diff options
-rw-r--r-- | drivers/net/ppp_async.c | 34 | ||||
-rw-r--r-- | drivers/net/ppp_generic.c | 126 | ||||
-rw-r--r-- | drivers/net/ppp_synctty.c | 27 |
3 files changed, 94 insertions, 93 deletions
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 8d278c87ba48..f023d5b67e6e 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -160,7 +160,7 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
160 | 160 | ||
161 | err = -ENOMEM; | 161 | err = -ENOMEM; |
162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
163 | if (ap == 0) | 163 | if (!ap) |
164 | goto out; | 164 | goto out; |
165 | 165 | ||
166 | /* initialize the asyncppp structure */ | 166 | /* initialize the asyncppp structure */ |
@@ -215,7 +215,7 @@ ppp_asynctty_close(struct tty_struct *tty) | |||
215 | ap = tty->disc_data; | 215 | ap = tty->disc_data; |
216 | tty->disc_data = NULL; | 216 | tty->disc_data = NULL; |
217 | write_unlock_irq(&disc_data_lock); | 217 | write_unlock_irq(&disc_data_lock); |
218 | if (ap == 0) | 218 | if (!ap) |
219 | return; | 219 | return; |
220 | 220 | ||
221 | /* | 221 | /* |
@@ -230,10 +230,10 @@ ppp_asynctty_close(struct tty_struct *tty) | |||
230 | tasklet_kill(&ap->tsk); | 230 | tasklet_kill(&ap->tsk); |
231 | 231 | ||
232 | ppp_unregister_channel(&ap->chan); | 232 | ppp_unregister_channel(&ap->chan); |
233 | if (ap->rpkt != 0) | 233 | if (ap->rpkt) |
234 | kfree_skb(ap->rpkt); | 234 | kfree_skb(ap->rpkt); |
235 | skb_queue_purge(&ap->rqueue); | 235 | skb_queue_purge(&ap->rqueue); |
236 | if (ap->tpkt != 0) | 236 | if (ap->tpkt) |
237 | kfree_skb(ap->tpkt); | 237 | kfree_skb(ap->tpkt); |
238 | kfree(ap); | 238 | kfree(ap); |
239 | } | 239 | } |
@@ -285,13 +285,13 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
285 | int err, val; | 285 | int err, val; |
286 | int __user *p = (int __user *)arg; | 286 | int __user *p = (int __user *)arg; |
287 | 287 | ||
288 | if (ap == 0) | 288 | if (!ap) |
289 | return -ENXIO; | 289 | return -ENXIO; |
290 | err = -EFAULT; | 290 | err = -EFAULT; |
291 | switch (cmd) { | 291 | switch (cmd) { |
292 | case PPPIOCGCHAN: | 292 | case PPPIOCGCHAN: |
293 | err = -ENXIO; | 293 | err = -ENXIO; |
294 | if (ap == 0) | 294 | if (!ap) |
295 | break; | 295 | break; |
296 | err = -EFAULT; | 296 | err = -EFAULT; |
297 | if (put_user(ppp_channel_index(&ap->chan), p)) | 297 | if (put_user(ppp_channel_index(&ap->chan), p)) |
@@ -301,7 +301,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file, | |||
301 | 301 | ||
302 | case PPPIOCGUNIT: | 302 | case PPPIOCGUNIT: |
303 | err = -ENXIO; | 303 | err = -ENXIO; |
304 | if (ap == 0) | 304 | if (!ap) |
305 | break; | 305 | break; |
306 | err = -EFAULT; | 306 | err = -EFAULT; |
307 | if (put_user(ppp_unit_number(&ap->chan), p)) | 307 | if (put_user(ppp_unit_number(&ap->chan), p)) |
@@ -350,7 +350,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
350 | struct asyncppp *ap = ap_get(tty); | 350 | struct asyncppp *ap = ap_get(tty); |
351 | unsigned long flags; | 351 | unsigned long flags; |
352 | 352 | ||
353 | if (ap == 0) | 353 | if (!ap) |
354 | return; | 354 | return; |
355 | spin_lock_irqsave(&ap->recv_lock, flags); | 355 | spin_lock_irqsave(&ap->recv_lock, flags); |
356 | ppp_async_input(ap, buf, cflags, count); | 356 | ppp_async_input(ap, buf, cflags, count); |
@@ -369,7 +369,7 @@ ppp_asynctty_wakeup(struct tty_struct *tty) | |||
369 | struct asyncppp *ap = ap_get(tty); | 369 | struct asyncppp *ap = ap_get(tty); |
370 | 370 | ||
371 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 371 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
372 | if (ap == 0) | 372 | if (!ap) |
373 | return; | 373 | return; |
374 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); | 374 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); |
375 | tasklet_schedule(&ap->tsk); | 375 | tasklet_schedule(&ap->tsk); |
@@ -684,7 +684,7 @@ ppp_async_push(struct asyncppp *ap) | |||
684 | tty_stuffed = 1; | 684 | tty_stuffed = 1; |
685 | continue; | 685 | continue; |
686 | } | 686 | } |
687 | if (ap->optr >= ap->olim && ap->tpkt != 0) { | 687 | if (ap->optr >= ap->olim && ap->tpkt) { |
688 | if (ppp_async_encode(ap)) { | 688 | if (ppp_async_encode(ap)) { |
689 | /* finished processing ap->tpkt */ | 689 | /* finished processing ap->tpkt */ |
690 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 690 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -704,7 +704,7 @@ ppp_async_push(struct asyncppp *ap) | |||
704 | clear_bit(XMIT_BUSY, &ap->xmit_flags); | 704 | clear_bit(XMIT_BUSY, &ap->xmit_flags); |
705 | /* any more work to do? if not, exit the loop */ | 705 | /* any more work to do? if not, exit the loop */ |
706 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) | 706 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) |
707 | || (!tty_stuffed && ap->tpkt != 0))) | 707 | || (!tty_stuffed && ap->tpkt))) |
708 | break; | 708 | break; |
709 | /* more work to do, see if we can do it now */ | 709 | /* more work to do, see if we can do it now */ |
710 | if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) | 710 | if (test_and_set_bit(XMIT_BUSY, &ap->xmit_flags)) |
@@ -715,7 +715,7 @@ ppp_async_push(struct asyncppp *ap) | |||
715 | 715 | ||
716 | flush: | 716 | flush: |
717 | clear_bit(XMIT_BUSY, &ap->xmit_flags); | 717 | clear_bit(XMIT_BUSY, &ap->xmit_flags); |
718 | if (ap->tpkt != 0) { | 718 | if (ap->tpkt) { |
719 | kfree_skb(ap->tpkt); | 719 | kfree_skb(ap->tpkt); |
720 | ap->tpkt = NULL; | 720 | ap->tpkt = NULL; |
721 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 721 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -848,7 +848,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
848 | s = 0; | 848 | s = 0; |
849 | for (i = 0; i < count; ++i) { | 849 | for (i = 0; i < count; ++i) { |
850 | c = buf[i]; | 850 | c = buf[i]; |
851 | if (flags != 0 && flags[i] != 0) | 851 | if (flags && flags[i] != 0) |
852 | continue; | 852 | continue; |
853 | s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; | 853 | s |= (c & 0x80)? SC_RCV_B7_1: SC_RCV_B7_0; |
854 | c = ((c >> 4) ^ c) & 0xf; | 854 | c = ((c >> 4) ^ c) & 0xf; |
@@ -865,7 +865,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
865 | n = scan_ordinary(ap, buf, count); | 865 | n = scan_ordinary(ap, buf, count); |
866 | 866 | ||
867 | f = 0; | 867 | f = 0; |
868 | if (flags != 0 && (ap->state & SC_TOSS) == 0) { | 868 | if (flags && (ap->state & SC_TOSS) == 0) { |
869 | /* check the flags to see if any char had an error */ | 869 | /* check the flags to see if any char had an error */ |
870 | for (j = 0; j < n; ++j) | 870 | for (j = 0; j < n; ++j) |
871 | if ((f = flags[j]) != 0) | 871 | if ((f = flags[j]) != 0) |
@@ -878,9 +878,9 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
878 | } else if (n > 0 && (ap->state & SC_TOSS) == 0) { | 878 | } else if (n > 0 && (ap->state & SC_TOSS) == 0) { |
879 | /* stuff the chars in the skb */ | 879 | /* stuff the chars in the skb */ |
880 | skb = ap->rpkt; | 880 | skb = ap->rpkt; |
881 | if (skb == 0) { | 881 | if (!skb) { |
882 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); | 882 | skb = dev_alloc_skb(ap->mru + PPP_HDRLEN + 2); |
883 | if (skb == 0) | 883 | if (!skb) |
884 | goto nomem; | 884 | goto nomem; |
885 | ap->rpkt = skb; | 885 | ap->rpkt = skb; |
886 | } | 886 | } |
@@ -927,7 +927,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
927 | ++n; | 927 | ++n; |
928 | 928 | ||
929 | buf += n; | 929 | buf += n; |
930 | if (flags != 0) | 930 | if (flags) |
931 | flags += n; | 931 | flags += n; |
932 | count -= n; | 932 | count -= n; |
933 | } | 933 | } |
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 | |||
1548 | ppp_receive_error(struct ppp *ppp) | 1548 | ppp_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); |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 00e2fb48b4ae..f0c6a1926a02 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -209,7 +209,7 @@ ppp_sync_open(struct tty_struct *tty) | |||
209 | 209 | ||
210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
211 | err = -ENOMEM; | 211 | err = -ENOMEM; |
212 | if (ap == 0) | 212 | if (!ap) |
213 | goto out; | 213 | goto out; |
214 | 214 | ||
215 | /* initialize the syncppp structure */ | 215 | /* initialize the syncppp structure */ |
@@ -262,7 +262,7 @@ ppp_sync_close(struct tty_struct *tty) | |||
262 | ap = tty->disc_data; | 262 | ap = tty->disc_data; |
263 | tty->disc_data = NULL; | 263 | tty->disc_data = NULL; |
264 | write_unlock_irq(&disc_data_lock); | 264 | write_unlock_irq(&disc_data_lock); |
265 | if (ap == 0) | 265 | if (!ap) |
266 | return; | 266 | return; |
267 | 267 | ||
268 | /* | 268 | /* |
@@ -278,7 +278,7 @@ ppp_sync_close(struct tty_struct *tty) | |||
278 | 278 | ||
279 | ppp_unregister_channel(&ap->chan); | 279 | ppp_unregister_channel(&ap->chan); |
280 | skb_queue_purge(&ap->rqueue); | 280 | skb_queue_purge(&ap->rqueue); |
281 | if (ap->tpkt != 0) | 281 | if (ap->tpkt) |
282 | kfree_skb(ap->tpkt); | 282 | kfree_skb(ap->tpkt); |
283 | kfree(ap); | 283 | kfree(ap); |
284 | } | 284 | } |
@@ -325,13 +325,13 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
325 | int __user *p = (int __user *)arg; | 325 | int __user *p = (int __user *)arg; |
326 | int err, val; | 326 | int err, val; |
327 | 327 | ||
328 | if (ap == 0) | 328 | if (!ap) |
329 | return -ENXIO; | 329 | return -ENXIO; |
330 | err = -EFAULT; | 330 | err = -EFAULT; |
331 | switch (cmd) { | 331 | switch (cmd) { |
332 | case PPPIOCGCHAN: | 332 | case PPPIOCGCHAN: |
333 | err = -ENXIO; | 333 | err = -ENXIO; |
334 | if (ap == 0) | 334 | if (!ap) |
335 | break; | 335 | break; |
336 | err = -EFAULT; | 336 | err = -EFAULT; |
337 | if (put_user(ppp_channel_index(&ap->chan), p)) | 337 | if (put_user(ppp_channel_index(&ap->chan), p)) |
@@ -341,7 +341,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file, | |||
341 | 341 | ||
342 | case PPPIOCGUNIT: | 342 | case PPPIOCGUNIT: |
343 | err = -ENXIO; | 343 | err = -ENXIO; |
344 | if (ap == 0) | 344 | if (!ap) |
345 | break; | 345 | break; |
346 | err = -EFAULT; | 346 | err = -EFAULT; |
347 | if (put_user(ppp_unit_number(&ap->chan), p)) | 347 | if (put_user(ppp_unit_number(&ap->chan), p)) |
@@ -390,7 +390,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
390 | struct syncppp *ap = sp_get(tty); | 390 | struct syncppp *ap = sp_get(tty); |
391 | unsigned long flags; | 391 | unsigned long flags; |
392 | 392 | ||
393 | if (ap == 0) | 393 | if (!ap) |
394 | return; | 394 | return; |
395 | spin_lock_irqsave(&ap->recv_lock, flags); | 395 | spin_lock_irqsave(&ap->recv_lock, flags); |
396 | ppp_sync_input(ap, buf, cflags, count); | 396 | ppp_sync_input(ap, buf, cflags, count); |
@@ -409,7 +409,7 @@ ppp_sync_wakeup(struct tty_struct *tty) | |||
409 | struct syncppp *ap = sp_get(tty); | 409 | struct syncppp *ap = sp_get(tty); |
410 | 410 | ||
411 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 411 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
412 | if (ap == 0) | 412 | if (!ap) |
413 | return; | 413 | return; |
414 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); | 414 | set_bit(XMIT_WAKEUP, &ap->xmit_flags); |
415 | tasklet_schedule(&ap->tsk); | 415 | tasklet_schedule(&ap->tsk); |
@@ -651,7 +651,7 @@ ppp_sync_push(struct syncppp *ap) | |||
651 | for (;;) { | 651 | for (;;) { |
652 | if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) | 652 | if (test_and_clear_bit(XMIT_WAKEUP, &ap->xmit_flags)) |
653 | tty_stuffed = 0; | 653 | tty_stuffed = 0; |
654 | if (!tty_stuffed && ap->tpkt != 0) { | 654 | if (!tty_stuffed && ap->tpkt) { |
655 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 655 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
656 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); | 656 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); |
657 | if (sent < 0) | 657 | if (sent < 0) |
@@ -669,7 +669,7 @@ ppp_sync_push(struct syncppp *ap) | |||
669 | /* haven't made any progress */ | 669 | /* haven't made any progress */ |
670 | spin_unlock_bh(&ap->xmit_lock); | 670 | spin_unlock_bh(&ap->xmit_lock); |
671 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) | 671 | if (!(test_bit(XMIT_WAKEUP, &ap->xmit_flags) |
672 | || (!tty_stuffed && ap->tpkt != 0))) | 672 | || (!tty_stuffed && ap->tpkt))) |
673 | break; | 673 | break; |
674 | if (!spin_trylock_bh(&ap->xmit_lock)) | 674 | if (!spin_trylock_bh(&ap->xmit_lock)) |
675 | break; | 675 | break; |
@@ -677,7 +677,7 @@ ppp_sync_push(struct syncppp *ap) | |||
677 | return done; | 677 | return done; |
678 | 678 | ||
679 | flush: | 679 | flush: |
680 | if (ap->tpkt != 0) { | 680 | if (ap->tpkt) { |
681 | kfree_skb(ap->tpkt); | 681 | kfree_skb(ap->tpkt); |
682 | ap->tpkt = NULL; | 682 | ap->tpkt = NULL; |
683 | clear_bit(XMIT_FULL, &ap->xmit_flags); | 683 | clear_bit(XMIT_FULL, &ap->xmit_flags); |
@@ -732,7 +732,8 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, | |||
732 | ppp_print_buffer ("receive buffer", buf, count); | 732 | ppp_print_buffer ("receive buffer", buf, count); |
733 | 733 | ||
734 | /* stuff the chars in the skb */ | 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 | printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); | 737 | printk(KERN_ERR "PPPsync: no memory (input pkt)\n"); |
737 | goto err; | 738 | goto err; |
738 | } | 739 | } |
@@ -740,7 +741,7 @@ ppp_sync_input(struct syncppp *ap, const unsigned char *buf, | |||
740 | if (buf[0] != PPP_ALLSTATIONS) | 741 | if (buf[0] != PPP_ALLSTATIONS) |
741 | skb_reserve(skb, 2 + (buf[0] & 1)); | 742 | skb_reserve(skb, 2 + (buf[0] & 1)); |
742 | 743 | ||
743 | if (flags != 0 && *flags) { | 744 | if (flags && *flags) { |
744 | /* error flag set, ignore frame */ | 745 | /* error flag set, ignore frame */ |
745 | goto err; | 746 | goto err; |
746 | } else if (count > skb_tailroom(skb)) { | 747 | } else if (count > skb_tailroom(skb)) { |