Re: [PATCH] hid: Fix uninitialized variable "size" in hid-wiimote-debug

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

 



Hi Simon

On Thu, Jan 17, 2013 at 8:47 PM, Simon Que <sque@xxxxxxxxxxxx> wrote:
> This variable is initialized conditionally, based on whether a wiimote
> call succeeds.  However, the logic is not obvious to the compiler so it
> throws a warning.  Eliminate the warning by initializing "size" to 0.

Hm, I think it says:

  54         ret = wiimote_cmd_wait(wdata);
  55         if (!ret)
  56                 size = wdata->state.cmd_read_size;

...not touching "size" or "ret" inbetween...

  64         if (ret)
  65                 return ret;

...using "size" below...

Weird that gcc cannot figure that out that there is no path to line 66
where "size" is uninitialized. Anyway, I am fine with this fix. We
test for "size == 0" anyway.

Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxxxxxxx>

Next time please copy the gcc-warning message verbatim into the
commit-message so we can more easily reproduce this and see which line
is affected.

Thanks for the patch
David
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux