aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/serial/visor.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index f5373ed2cd45..8ddbecc25d89 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -335,47 +335,48 @@ static int palm_os_3_probe(struct usb_serial *serial,
335 goto exit; 335 goto exit;
336 } 336 }
337 337
338 if (retval == sizeof(*connection_info)) { 338 if (retval != sizeof(*connection_info)) {
339 connection_info = (struct visor_connection_info *) 339 dev_err(dev, "Invalid connection information received from device\n");
340 transfer_buffer; 340 retval = -ENODEV;
341 341 goto exit;
342 num_ports = le16_to_cpu(connection_info->num_ports);
343 for (i = 0; i < num_ports; ++i) {
344 switch (
345 connection_info->connections[i].port_function_id) {
346 case VISOR_FUNCTION_GENERIC:
347 string = "Generic";
348 break;
349 case VISOR_FUNCTION_DEBUGGER:
350 string = "Debugger";
351 break;
352 case VISOR_FUNCTION_HOTSYNC:
353 string = "HotSync";
354 break;
355 case VISOR_FUNCTION_CONSOLE:
356 string = "Console";
357 break;
358 case VISOR_FUNCTION_REMOTE_FILE_SYS:
359 string = "Remote File System";
360 break;
361 default:
362 string = "unknown";
363 break;
364 }
365 dev_info(dev, "%s: port %d, is for %s use\n",
366 serial->type->description,
367 connection_info->connections[i].port, string);
368 }
369 } 342 }
370 /* 343
371 * Handle devices that report invalid stuff here. 344 connection_info = (struct visor_connection_info *)transfer_buffer;
372 */ 345
346 num_ports = le16_to_cpu(connection_info->num_ports);
347
348 /* Handle devices that report invalid stuff here. */
373 if (num_ports == 0 || num_ports > 2) { 349 if (num_ports == 0 || num_ports > 2) {
374 dev_warn(dev, "%s: No valid connect info available\n", 350 dev_warn(dev, "%s: No valid connect info available\n",
375 serial->type->description); 351 serial->type->description);
376 num_ports = 2; 352 num_ports = 2;
377 } 353 }
378 354
355 for (i = 0; i < num_ports; ++i) {
356 switch (connection_info->connections[i].port_function_id) {
357 case VISOR_FUNCTION_GENERIC:
358 string = "Generic";
359 break;
360 case VISOR_FUNCTION_DEBUGGER:
361 string = "Debugger";
362 break;
363 case VISOR_FUNCTION_HOTSYNC:
364 string = "HotSync";
365 break;
366 case VISOR_FUNCTION_CONSOLE:
367 string = "Console";
368 break;
369 case VISOR_FUNCTION_REMOTE_FILE_SYS:
370 string = "Remote File System";
371 break;
372 default:
373 string = "unknown";
374 break;
375 }
376 dev_info(dev, "%s: port %d, is for %s use\n",
377 serial->type->description,
378 connection_info->connections[i].port, string);
379 }
379 dev_info(dev, "%s: Number of ports: %d\n", serial->type->description, 380 dev_info(dev, "%s: Number of ports: %d\n", serial->type->description,
380 num_ports); 381 num_ports);
381 382