drivers/usb/misc/ftdi-elan.c: odd retry code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(It seems as if elandigitalsystems.com doesn't exist
 any longer, Tony Olech cc'd just for the hellofit)

Code like this seems to be an infinite loop
if command_size >= COMMAND_SIZE and elan_command_work
returns -ENOMEM.

There are a lot of them in this driver.

Is this never-tested/defective, or am I misreading?

static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data)
{
      wait:if (ftdi->disconnected > 0) {
                return -ENODEV;
        } else {
                int command_size;
                mutex_lock(&ftdi->u132_lock);
                command_size = ftdi->command_next - ftdi->command_head;
                if (command_size < COMMAND_SIZE) {
                        struct u132_command *command = &ftdi->command[
                                COMMAND_MASK & ftdi->command_next];
                        command->header = 0x00 | cPCIu132wr;
                        command->length = 0x04;
                        command->address = 0x00;
                        command->width = 0x00;
                        command->follows = 4;
                        command->value = data;
                        command->buffer = &command->value;
                        ftdi->command_next += 1;
                        ftdi_elan_kick_command_queue(ftdi);
                        mutex_unlock(&ftdi->u132_lock);
                        return 0;
                } else {
                        mutex_unlock(&ftdi->u132_lock);
                        msleep(100);
                        goto wait;
                }
        }
}


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux