diff options
author | Marton Nemeth <nm127@freemail.hu> | 2009-11-05 03:35:08 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:20 -0500 |
commit | 4f7309e27865b88df7b0b0ad59e0376dba1806af (patch) | |
tree | 9ea7e7c963d9ff1197234b2ee08f5bb88766bdd6 /drivers/media/video | |
parent | 56205cc0dd703be70b4ea1138a7e774e058d79fa (diff) |
V4L/DVB (13324): gspca - pac7302/pac7311: Handle return value of usb_control_msg().
The function usb_control_msg() can return error any time so at least
warn the user if an error happens. No message is printed in case of
normal operation.
Signed-off-by: Marton Nemeth <nm127@freemail.hu>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/gspca/pac7302.c | 24 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac7311.c | 24 |
2 files changed, 42 insertions, 6 deletions
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c index 228b414709f7..60d1a31f5307 100644 --- a/drivers/media/video/gspca/pac7302.c +++ b/drivers/media/video/gspca/pac7302.c | |||
@@ -335,14 +335,20 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, | |||
335 | __u8 index, | 335 | __u8 index, |
336 | const char *buffer, int len) | 336 | const char *buffer, int len) |
337 | { | 337 | { |
338 | int ret; | ||
339 | |||
338 | memcpy(gspca_dev->usb_buf, buffer, len); | 340 | memcpy(gspca_dev->usb_buf, buffer, len); |
339 | usb_control_msg(gspca_dev->dev, | 341 | ret = usb_control_msg(gspca_dev->dev, |
340 | usb_sndctrlpipe(gspca_dev->dev, 0), | 342 | usb_sndctrlpipe(gspca_dev->dev, 0), |
341 | 1, /* request */ | 343 | 1, /* request */ |
342 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 344 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
343 | 0, /* value */ | 345 | 0, /* value */ |
344 | index, gspca_dev->usb_buf, len, | 346 | index, gspca_dev->usb_buf, len, |
345 | 500); | 347 | 500); |
348 | if (ret < 0) | ||
349 | PDEBUG(D_ERR, "reg_w_buf(): " | ||
350 | "Failed to write registers to index 0x%x, error %i", | ||
351 | index, ret); | ||
346 | } | 352 | } |
347 | 353 | ||
348 | 354 | ||
@@ -350,13 +356,19 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
350 | __u8 index, | 356 | __u8 index, |
351 | __u8 value) | 357 | __u8 value) |
352 | { | 358 | { |
359 | int ret; | ||
360 | |||
353 | gspca_dev->usb_buf[0] = value; | 361 | gspca_dev->usb_buf[0] = value; |
354 | usb_control_msg(gspca_dev->dev, | 362 | ret = usb_control_msg(gspca_dev->dev, |
355 | usb_sndctrlpipe(gspca_dev->dev, 0), | 363 | usb_sndctrlpipe(gspca_dev->dev, 0), |
356 | 0, /* request */ | 364 | 0, /* request */ |
357 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 365 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
358 | 0, index, gspca_dev->usb_buf, 1, | 366 | 0, index, gspca_dev->usb_buf, 1, |
359 | 500); | 367 | 500); |
368 | if (ret < 0) | ||
369 | PDEBUG(D_ERR, "reg_w(): " | ||
370 | "Failed to write register to index 0x%x, value 0x%x, error %i", | ||
371 | index, value, ret); | ||
360 | } | 372 | } |
361 | 373 | ||
362 | static void reg_w_seq(struct gspca_dev *gspca_dev, | 374 | static void reg_w_seq(struct gspca_dev *gspca_dev, |
@@ -373,17 +385,23 @@ static void reg_w_page(struct gspca_dev *gspca_dev, | |||
373 | const __u8 *page, int len) | 385 | const __u8 *page, int len) |
374 | { | 386 | { |
375 | int index; | 387 | int index; |
388 | int ret; | ||
376 | 389 | ||
377 | for (index = 0; index < len; index++) { | 390 | for (index = 0; index < len; index++) { |
378 | if (page[index] == SKIP) /* skip this index */ | 391 | if (page[index] == SKIP) /* skip this index */ |
379 | continue; | 392 | continue; |
380 | gspca_dev->usb_buf[0] = page[index]; | 393 | gspca_dev->usb_buf[0] = page[index]; |
381 | usb_control_msg(gspca_dev->dev, | 394 | ret = usb_control_msg(gspca_dev->dev, |
382 | usb_sndctrlpipe(gspca_dev->dev, 0), | 395 | usb_sndctrlpipe(gspca_dev->dev, 0), |
383 | 0, /* request */ | 396 | 0, /* request */ |
384 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 397 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
385 | 0, index, gspca_dev->usb_buf, 1, | 398 | 0, index, gspca_dev->usb_buf, 1, |
386 | 500); | 399 | 500); |
400 | if (ret < 0) | ||
401 | PDEBUG(D_ERR, "reg_w_page(): " | ||
402 | "Failed to write register to index 0x%x, " | ||
403 | "value 0x%x, error %i", | ||
404 | index, page[index], ret); | ||
387 | } | 405 | } |
388 | } | 406 | } |
389 | 407 | ||
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index a2f788468ec0..82cdd43aada9 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c | |||
@@ -263,14 +263,20 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, | |||
263 | __u8 index, | 263 | __u8 index, |
264 | const char *buffer, int len) | 264 | const char *buffer, int len) |
265 | { | 265 | { |
266 | int ret; | ||
267 | |||
266 | memcpy(gspca_dev->usb_buf, buffer, len); | 268 | memcpy(gspca_dev->usb_buf, buffer, len); |
267 | usb_control_msg(gspca_dev->dev, | 269 | ret = usb_control_msg(gspca_dev->dev, |
268 | usb_sndctrlpipe(gspca_dev->dev, 0), | 270 | usb_sndctrlpipe(gspca_dev->dev, 0), |
269 | 1, /* request */ | 271 | 1, /* request */ |
270 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 272 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
271 | 0, /* value */ | 273 | 0, /* value */ |
272 | index, gspca_dev->usb_buf, len, | 274 | index, gspca_dev->usb_buf, len, |
273 | 500); | 275 | 500); |
276 | if (ret < 0) | ||
277 | PDEBUG(D_ERR, "reg_w_buf(): " | ||
278 | "Failed to write registers to index 0x%x, error %i", | ||
279 | index, ret); | ||
274 | } | 280 | } |
275 | 281 | ||
276 | 282 | ||
@@ -278,13 +284,19 @@ static void reg_w(struct gspca_dev *gspca_dev, | |||
278 | __u8 index, | 284 | __u8 index, |
279 | __u8 value) | 285 | __u8 value) |
280 | { | 286 | { |
287 | int ret; | ||
288 | |||
281 | gspca_dev->usb_buf[0] = value; | 289 | gspca_dev->usb_buf[0] = value; |
282 | usb_control_msg(gspca_dev->dev, | 290 | ret = usb_control_msg(gspca_dev->dev, |
283 | usb_sndctrlpipe(gspca_dev->dev, 0), | 291 | usb_sndctrlpipe(gspca_dev->dev, 0), |
284 | 0, /* request */ | 292 | 0, /* request */ |
285 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 293 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
286 | 0, index, gspca_dev->usb_buf, 1, | 294 | 0, index, gspca_dev->usb_buf, 1, |
287 | 500); | 295 | 500); |
296 | if (ret < 0) | ||
297 | PDEBUG(D_ERR, "reg_w(): " | ||
298 | "Failed to write register to index 0x%x, value 0x%x, error %i", | ||
299 | index, value, ret); | ||
288 | } | 300 | } |
289 | 301 | ||
290 | static void reg_w_seq(struct gspca_dev *gspca_dev, | 302 | static void reg_w_seq(struct gspca_dev *gspca_dev, |
@@ -301,17 +313,23 @@ static void reg_w_page(struct gspca_dev *gspca_dev, | |||
301 | const __u8 *page, int len) | 313 | const __u8 *page, int len) |
302 | { | 314 | { |
303 | int index; | 315 | int index; |
316 | int ret; | ||
304 | 317 | ||
305 | for (index = 0; index < len; index++) { | 318 | for (index = 0; index < len; index++) { |
306 | if (page[index] == SKIP) /* skip this index */ | 319 | if (page[index] == SKIP) /* skip this index */ |
307 | continue; | 320 | continue; |
308 | gspca_dev->usb_buf[0] = page[index]; | 321 | gspca_dev->usb_buf[0] = page[index]; |
309 | usb_control_msg(gspca_dev->dev, | 322 | ret = usb_control_msg(gspca_dev->dev, |
310 | usb_sndctrlpipe(gspca_dev->dev, 0), | 323 | usb_sndctrlpipe(gspca_dev->dev, 0), |
311 | 0, /* request */ | 324 | 0, /* request */ |
312 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 325 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
313 | 0, index, gspca_dev->usb_buf, 1, | 326 | 0, index, gspca_dev->usb_buf, 1, |
314 | 500); | 327 | 500); |
328 | if (ret < 0) | ||
329 | PDEBUG(D_ERR, "reg_w_page(): " | ||
330 | "Failed to write register to index 0x%x, " | ||
331 | "value 0x%x, error %i", | ||
332 | index, page[index], ret); | ||
315 | } | 333 | } |
316 | } | 334 | } |
317 | 335 | ||