Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305498

Re: [PATCH] tty: fix badzero.cocci warnings

From Peter Hurley <peter@hurleysoftware.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tty: fix badzero.cocci warnings
Date 2016-01-10 08:10 +0100
Message-ID <qPiiu-XG-7@gated-at.bofh.it> (permalink)
References <qPhFL-sq-1@gated-at.bofh.it> <qPhFM-sq-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/09/2016 10:24 PM, kbuild test robot wrote:
> drivers/tty/tty_io.c:731:36-37: WARNING comparing pointer to 0
> 
>  Compare pointer-typed values to NULL rather than 0
> 
> Semantic patch information:
>  This makes an effort to choose between !x and x == NULL.  !x is used
>  if it has previously been used with the function used to initialize x.
>  This relies on type information.  More type information can be obtained
>  using the option -all_includes and the option -I to specify an
>  include path.
> 
> Generated by: scripts/coccinelle/null/badzero.cocci

Not sure what possessed me to write 'cons_filp != 0'. Not my style, for sure.
Thanks.

Regards,
Peter Hurley

> CC: Peter Hurley <peter@hurleysoftware.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  tty_io.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -728,7 +728,7 @@ static void __tty_hangup(struct tty_stru
>  	while (refs--)
>  		tty_kref_put(tty);
>  
> -	tty_ldisc_hangup(tty, cons_filp != 0);
> +	tty_ldisc_hangup(tty, cons_filp != NULL);
>  
>  	spin_lock_irq(&tty->ctrl_lock);
>  	clear_bit(TTY_THROTTLED, &tty->flags);
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 17/19] tty: Destroy ldisc instance on hangup Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 05:50 +0100
  Re: [PATCH v2 17/19] tty: Destroy ldisc instance on hangup kbuild test robot <lkp@intel.com> - 2016-01-10 07:30 +0100
  [PATCH] tty: fix badzero.cocci warnings kbuild test robot <lkp@intel.com> - 2016-01-10 07:30 +0100
    Re: [PATCH] tty: fix badzero.cocci warnings Peter Hurley <peter@hurleysoftware.com> - 2016-01-10 08:10 +0100

csiph-web