From: Mauro Carvalho Chehab Date: Mon, 27 Dec 2010 15:00:03 +0000 (-0300) Subject: [media] gspca: Fix a warning for using len before filling it X-Git-Tag: v2.6.38-rc1~470^2~66 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95f18be2e4f74255b46fcc23a9718cca9c7375c9;p=pandora-kernel.git [media] gspca: Fix a warning for using len before filling it The check for status errors is now before the check for len. That's ok. However, the error printk's for the status error prints the URB length. This generates this error: drivers/media/video/gspca/gspca.c: In function ‘fill_frame’: drivers/media/video/gspca/gspca.c:305:9: warning: ‘len’ may be used uninitialized in this function The fix is as simple as moving the len init to happen before the checks. Cc: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 92b5dfb12ed1..80b31ebb5b95 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -318,6 +318,7 @@ static void fill_frame(struct gspca_dev *gspca_dev, } pkt_scan = gspca_dev->sd_desc->pkt_scan; for (i = 0; i < urb->number_of_packets; i++) { + len = urb->iso_frame_desc[i].actual_length; /* check the packet status and length */ st = urb->iso_frame_desc[i].status; @@ -327,7 +328,6 @@ static void fill_frame(struct gspca_dev *gspca_dev, gspca_dev->last_packet_type = DISCARD_PACKET; continue; } - len = urb->iso_frame_desc[i].actual_length; if (len == 0) { if (gspca_dev->empty_packet == 0) gspca_dev->empty_packet = 1;