aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-12-27 10:00:03 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:17:14 -0500
commit95f18be2e4f74255b46fcc23a9718cca9c7375c9 (patch)
treef4b1e8593b02175db3a49623a8746336908d4660
parent2e94b53c55d00b4d4d4b9e65007566f7fbffab7a (diff)
[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 <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/gspca/gspca.c2
1 files changed, 1 insertions, 1 deletions
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,
318 } 318 }
319 pkt_scan = gspca_dev->sd_desc->pkt_scan; 319 pkt_scan = gspca_dev->sd_desc->pkt_scan;
320 for (i = 0; i < urb->number_of_packets; i++) { 320 for (i = 0; i < urb->number_of_packets; i++) {
321 len = urb->iso_frame_desc[i].actual_length;
321 322
322 /* check the packet status and length */ 323 /* check the packet status and length */
323 st = urb->iso_frame_desc[i].status; 324 st = urb->iso_frame_desc[i].status;
@@ -327,7 +328,6 @@ static void fill_frame(struct gspca_dev *gspca_dev,
327 gspca_dev->last_packet_type = DISCARD_PACKET; 328 gspca_dev->last_packet_type = DISCARD_PACKET;
328 continue; 329 continue;
329 } 330 }
330 len = urb->iso_frame_desc[i].actual_length;
331 if (len == 0) { 331 if (len == 0) {
332 if (gspca_dev->empty_packet == 0) 332 if (gspca_dev->empty_packet == 0)
333 gspca_dev->empty_packet = 1; 333 gspca_dev->empty_packet = 1;