From: Joe Perches <joe@perches.com>
To: Jacek Anaszewski <j.anaszewski@samsung.com>, linux-leds@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, greg@kroah.com
Subject: Re: [PATCH v2] leds: triggers: Check return value of kobject_uevent_env()
Date: Mon, 19 Sep 2016 03:19:10 -0700 [thread overview]
Message-ID: <1474280350.1954.20.camel@perches.com> (raw)
In-Reply-To: <1474279534-30204-1-git-send-email-j.anaszewski@samsung.com>
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.
prev parent reply other threads:[~2016-09-19 10:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 10:05 Jacek Anaszewski
2016-09-19 10:19 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474280350.1954.20.camel@perches.com \
--to=joe@perches.com \
--cc=greg@kroah.com \
--cc=j.anaszewski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome