Re: [PATCH v8 2/6] usb: ljca: Add transport interfaces for sub-module drivers

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

 





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@xxxxxxxxx>
---

+
+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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux