aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ppp_async.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ppp_async.c')
-rw-r--r--drivers/net/ppp_async.c34
1 files changed, 17 insertions, 17 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
716flush: 716flush:
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 }