summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-12-27 12:00:03 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 08:17:14 -0200
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 92b5dfb12ed..80b31ebb5b9 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;