Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c (sparse warning)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 15, 2013 at 03:22:24PM +0100, Peter Huewe wrote:
> This patch fixes the warning "Using plain integer as NULL pointer",
> generated by sparse, by replacing the offending 0s with NULL.
> 
> If the initialization with NULL was unnecessary (due to unconditional
> assignment before first use) it was removed.
> 
> Signed-off-by: Peter Huewe <peterhuewe@xxxxxx>
> ---
> @@ -151,7 +151,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)
>  int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
>  {
>  	struct list_head *e;
> -	struct oz_elt_stream *st;
> +	struct oz_elt_stream *st = NULL;
>  	oz_trace("oz_elt_stream_delete(0x%x)\n", id);
>  	spin_lock_bh(&buf->lock);
>  	e = buf->stream_list.next;

You changed the code here.  The original code would crash if
buf->stream_list was empty.  I don't if that can happen, but I still
consider it a bug fix.

Good job, but next time you mention it in the changelog.

You've fixed a couple of these uninitialized variable bugs recently.
Is this is a clang warning?  GCC doesn't catch it.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux