diff options
author | Joe Perches <joe@perches.com> | 2007-11-12 21:07:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-11-12 21:07:31 -0500 |
commit | cd228d5458186f66bc36c4884f4f26ed955c5945 (patch) | |
tree | 4907bf4503816cc13b457250d3fae567ee627286 /drivers/net/ppp_synctty.c | |
parent | dbb2ed24851a290616d66212dc75373fd863d636 (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_synctty.c')
-rw-r--r-- | drivers/net/ppp_synctty.c | 27 |
1 files changed, 14 insertions, 13 deletions
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)) { |