[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1474280350.1954.20.camel@perches.com>
Date: Mon, 19 Sep 2016 03:19:10 -0700
From: Joe Perches <joe@...ches.com>
To: Jacek Anaszewski <j.anaszewski@...sung.com>,
linux-leds@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, greg@...ah.com
Subject: Re: [PATCH v2] leds: triggers: Check return value of
kobject_uevent_env()
On Mon, 2016-09-19 at 12:05 +0200, Jacek Anaszewski wrote:
> Log error message if kobject_uevent_env() fails in led_trigger_set().
trivia:
> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
[]
> @@ -141,7 +141,9 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
> if (event) {
> envp[0] = event;
> envp[1] = NULL;
> - kobject_uevent_env(&led_cdev->dev->kobj, KOBJ_CHANGE, envp);
> + if (kobject_uevent_env(&led_cdev->dev->kobj, KOBJ_CHANGE, envp))
> + dev_err(led_cdev->dev,
> + "led_trigger_set: Error sending uevent\n");
It is generally better to use %s, __func__ than to embed
a function name in the format string.
+ dev_err(led_cdev->dev, "%s: Error sending uevent\n",
+ __func__);
Then Function renaming and code refactoring is less
error prone.
Powered by blists - more mailing lists