lkml.org 
[lkml]   [2023]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v8 2/6] usb: ljca: Add transport interfaces for sub-module drivers
From


On 11.05.23 19:58, Ye Xiang wrote:
> Adds the transport interfaces for various LJCA sub-module drivers
> to communicate with LJCA hardware. The sub-modules of LJCA can use
> ljca_transfer() to issue a transfer between host and hardware. And
> ljca_register_event_cb is exported to LJCA sub-module drivers for
> hardware event subscription.
>
> Signed-off-by: Ye Xiang <xiang.ye@intel.com>
> ---

> +
> +int ljca_register_event_cb(struct ljca *ljca, ljca_event_cb_t event_cb, void *context)
> +{
> + struct ljca_event_cb_entry *entry, *iter;
> + struct ljca_stub *stub;
> + unsigned long flags;
> + int ret;

Uninitialized variable

> +
> + stub = ljca_stub_find(ljca->dev, ljca->type);
> + if (IS_ERR(stub))
> + return PTR_ERR(stub);
> +
> + entry = kzalloc(sizeof(*entry), GFP_KERNEL);
> + if (!entry)
> + return -ENOMEM;
> +
> + entry->notify = event_cb;
> + entry->context = context;
> + entry->id = ljca->id;
> +
> + spin_lock_irqsave(&stub->event_cb_lock, flags);

You are using GFP_KERNEL a few lines earlier. No need for irqsave

> +
> + list_for_each_entry(iter, &stub->event_entrys, list) {
> + if (iter->id == ljca->id) {
> + ret = -EBUSY;
> + break;
> + }
> + }
> +
> + if (!ret)
> + list_add_tail(&entry->list, &stub->event_entrys);
> +
> + spin_unlock_irqrestore(&stub->event_cb_lock, flags);
> +
> + if (ret)
> + kfree(entry);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_NS_GPL(ljca_register_event_cb, LJCA);

Regards
Oliver

\
 
 \ /
  Last update: 2023-05-22 11:38    [W:0.338 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site