On 5/5/19 10:12 PM, Pavel Machek wrote:
Hi!
+ led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
+ if (!led)
+ return -ENOMEM;
+
+ led->spi = spi;
+ strlcpy(led->name, name, sizeof(led->name));
+ mutex_init(&led->mutex);
+ led->off_value = off_value;
+ led->max_value = max_value;
+ led->ldev.name = led->name;
+ led->ldev.brightness = LED_OFF;
This line is redundant - already zeroed by kzalloc.
Actually I'd prefer to leave it in. Yes, LED_OFF == 0, and will
probably stay == 0 in future, but...
but what? I don't really see a sufficient justification for
leaving it. Just redundant line. In other place in my LED naming
patch set you wondered if it wouldn't have been better to initialize
a struct partly using initialization list, I suspect to save few
LOC. So here you seem to be inconsistent :-)
--
Best regards,
Jacek Anaszewski