lkml.org 
[lkml]   [2022]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 1/3] mfd: ch341: add core driver for the WCH CH341 in I2C/SPI/GPIO mode
From
Hi Johan,

On 5/23/22 10:56, Johan Hovold wrote:

>> +
>> + dev = devm_kzalloc(&iface->dev, sizeof(*dev), GFP_KERNEL);
>> + if (!dev)
>> + return -ENOMEM;
>> +
>> + dev->usb_dev = usb_get_dev(interface_to_usbdev(iface));
>
> No need to grab a reference unless you're going to hold on to it past
> disconnect().

I removed that.


>> +
>> + endpoints = iface->cur_altsetting->endpoint;
>> + if (!usb_endpoint_is_bulk_in(&endpoints[0].desc) ||
>> + !usb_endpoint_is_bulk_out(&endpoints[1].desc) ||
>> + !usb_endpoint_xfer_int(&endpoints[2].desc)) {
>> + rc = -ENODEV;
>> + goto free_dev;
>> + }
>
> Please use usb_find_common_endpoints() for the above.

Thanks. I wasn't aware on that API. It simplifies things a bit.

Regards,
Frank.

\
 
 \ /
  Last update: 2022-06-16 03:26    [W:0.351 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site