[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADZsf3Y=Z9pys=g1QtN=+vhLDV=NVK=rbF14Duv50expF=gzeA@mail.gmail.com>
Date: Sat, 10 Oct 2020 01:25:43 +0200
From: Luka Kovacic <luka.kovacic@...tura.hr>
To: Pavel Machek <pavel@....cz>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-hwmon@...r.kernel.org,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
Lee Jones <lee.jones@...aro.org>, Dan Murphy <dmurphy@...com>,
Rob Herring <robh+dt@...nel.org>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Marek Behun <marek.behun@....cz>,
Luka Perkov <luka.perkov@...tura.hr>,
Robert Marko <robert.marko@...tura.hr>
Subject: Re: [PATCH v4 4/6] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver
On Wed, Oct 7, 2020 at 1:27 PM Pavel Machek <pavel@....cz> wrote:
>
> Hi!
>
> > Add support for the iEi WT61P803 PUZZLE LED driver.
> > Currently only the front panel power LED is supported.
> >
> > This driver depends on the iEi WT61P803 PUZZLE MFD driver.
>
> > +static int iei_wt61p803_puzzle_led_brightness_set_blocking(struct led_classdev *cdev,
> > + enum led_brightness brightness)
> > +{
> > + struct iei_wt61p803_puzzle_led *priv = cdev_to_iei_wt61p803_puzzle_led(cdev);
> > + unsigned char *resp_buf = priv->response_buffer;
> > + unsigned char led_power_cmd[5] = {
> > + IEI_WT61P803_PUZZLE_CMD_HEADER_START,
> > + IEI_WT61P803_PUZZLE_CMD_LED,
> > + IEI_WT61P803_PUZZLE_CMD_LED_POWER,
> > + (char)IEI_LED_OFF
> > + };
> > + size_t reply_size;
> > +
> > + mutex_lock(&priv->lock);
> > + if (brightness == LED_OFF) {
> > + led_power_cmd[3] = (char)IEI_LED_OFF;
> > + priv->led_power_state = LED_OFF;
> > + } else {
> > + led_power_cmd[3] = (char)IEI_LED_ON;
> > + priv->led_power_state = LED_ON;
> > + }
> > + mutex_unlock(&priv->lock);
>
> Are you sure you need the mutex?
>
> > + ret = devm_led_classdev_register_ext(dev, &priv->cdev, &init_data);
> > + if (ret) {
> > + dev_err(dev, "Could not register LED\n");
> > + goto err_child_node;
> > + }
> > + return 0;
> > +err_child_node:
> > + fwnode_handle_put(child);
> > + return ret;
> > +}
>
> Is the fwnode_handle_put(child); missing in non-error path somewhere?
>
> > +MODULE_LICENSE("GPL");
>
> Make sure this is consistent with file header. GPLv2+, if you can.
>
> Best regards,
>
> Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi Pavel,
The mutex is locked in
iei_wt61p803_puzzle_led_brightness_set_blocking(), as concurrent
access to the same private structure member should be possible, when
reading the state
from iei_wt61p803_puzzle_led_brightness_get().
It does look like I missed the final fwnode_handle_put(child) here.
My understanding regarding the license is that when
MODULE_LICENSE("GPL") is used
the SPDX identifier can either be GPL-2.0-only or GPL-2.0-or-later.
Kind regards,
Luka
Powered by blists - more mailing lists