Skip to content

Commit

Permalink
Staging: lirc: fix compiler warning
Browse files Browse the repository at this point in the history
On Fri, Aug 13, 2010 at 03:38:40PM +0200, Dan Carpenter wrote:
> Speak of left over stuff, it's weird that I didn't notice this before
> but gcc complains about an unitialized variable in
> imon_incoming_packet().
>
> drivers/staging/lirc/lirc_imon.c: In function ‘imon_incoming_packet’:
> drivers/staging/lirc/lirc_imon.c:661: warning: ‘chunk_num’ may be used
> 	uninitialized in this function
>
> I don't know how to fix that, but it looks important.

Ew. Yeah, that doesn't look so hot like it is right now. The old lirc_imon
driver had chunk_num = buf[7], and made much more extensive use of
chunk_num. Simply removing chunk_num and using buf[7] should be fine.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jarod Wilson authored and Greg Kroah-Hartman committed Aug 31, 2010
1 parent c37c6d2 commit 2116739
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/lirc/lirc_imon.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ static void imon_incoming_packet(struct imon_context *context,
struct device *dev = context->driver->dev;
int octet, bit;
unsigned char mask;
int i, chunk_num;
int i;

/*
* just bail out if no listening IR client
Expand Down Expand Up @@ -655,7 +655,7 @@ static void imon_incoming_packet(struct imon_context *context,
}
}

if (chunk_num == 10) {
if (buf[7] == 10) {
if (context->rx.count) {
submit_data(context);
context->rx.count = 0;
Expand Down

0 comments on commit 2116739

Please sign in to comment.