aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/pac7311.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/pac7311.c')
-rw-r--r--drivers/media/video/gspca/pac7311.c24
1 files changed, 21 insertions, 3 deletions
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
290static void reg_w_seq(struct gspca_dev *gspca_dev, 302static 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