[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cbec7486-d1dc-8597-3711-a7a3ee3ec517@suse.com>
Date: Mon, 22 May 2023 11:36:13 +0200
From: Oliver Neukum <oneukum@...e.com>
To: Ye Xiang <xiang.ye@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
Matthias Kaehlcke <mka@...omium.org>,
Lee Jones <lee@...nel.org>, Wolfram Sang <wsa@...nel.org>,
Tyrone Ting <kfting@...oton.com>,
Mark Brown <broonie@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Marc Zyngier <maz@...nel.org>,
Bartosz Golaszewski <brgl@...ev.pl>, linux-usb@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-spi@...r.kernel.org, linux-gpio@...r.kernel.org
Cc: srinivas.pandruvada@...el.com, heikki.krogerus@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, sakari.ailus@...ux.intel.com,
zhifeng.wang@...el.com, wentong.wu@...el.com, lixu.zhang@...el.com
Subject: Re: [PATCH v8 2/6] usb: ljca: Add transport interfaces for sub-module
drivers
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@...el.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
Powered by blists - more mailing lists