[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94bdabf4-0922-5016-ed96-9916ed6bda9d@ti.com>
Date: Wed, 31 Jul 2019 16:23:07 +0300
From: Tomi Valkeinen <tomi.valkeinen@...com>
To: Jean-Jacques Hiblot <jjhiblot@...com>,
<jacek.anaszewski@...il.com>, <pavel@....cz>, <robh+dt@...nel.org>,
<mark.rutland@....com>, <lee.jones@...aro.org>,
<daniel.thompson@...aro.org>, <jingoohan1@...il.com>
CC: <dmurphy@...com>, <linux-leds@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH v4 2/4] leds: Add managed API to get a LED from a device
driver
On 17/07/2019 17:15, Jean-Jacques Hiblot wrote:
> +struct led_classdev *__must_check devm_led_get(struct device *dev,
> + int index)
> +{
> + struct led_classdev *led;
> + struct led_classdev **dr;
> +
Should you check here if dev->of_node == NULL? Or should of_led_get()
check it.
> + led = of_led_get(dev->of_node, index);
> + if (IS_ERR(led))
> + return led;
> +
> + dr = devres_alloc(devm_led_release, sizeof(struct led_classdev *),
> + GFP_KERNEL);
> + if (!dr) {
> + led_put(led);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + *dr = led;
> + devres_add(dev, dr);
> +
> + return led;
> +}
Tomi
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Powered by blists - more mailing lists