From: Jiri Kosina <jikos@kernel.org>
To: Zhouyang Jia <jiazhouyang09@gmail.com>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: hid-ntrig: add error handling for sysfs_create_group
Date: Mon, 11 Jun 2018 14:20:30 +0200 (CEST) [thread overview]
Message-ID: <nycvar.YFH.7.76.1806111419480.6203@cbobk.fhfr.pm> (raw)
In-Reply-To: <1528707296-35785-1-git-send-email-jiazhouyang09@gmail.com>
On Mon, 11 Jun 2018, Zhouyang Jia wrote:
> When sysfs_create_group fails, the lack of error-handling code may
> cause unexpected results.
>
> This patch adds error-handling code after calling sysfs_create_group.
>
> Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
> ---
> drivers/hid/hid-ntrig.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
> index 43b1c72..1e70dae 100644
> --- a/drivers/hid/hid-ntrig.c
> +++ b/drivers/hid/hid-ntrig.c
> @@ -955,6 +955,10 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
>
> ret = sysfs_create_group(&hdev->dev.kobj,
> &ntrig_attribute_group);
> + if (ret) {
> + hid_err(hdev, "cannot create sysfs group\n");
> + goto err_free;
> + }
Is it really necessarily to bail out completely here and render the device
dysfunctional? Issuing a warning about sysfs knobs being unavailable might
be more appropriate.
Thanks,
--
Jiri Kosina
SUSE Labs
next prev parent reply other threads:[~2018-06-11 12:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 8:54 Zhouyang Jia
2018-06-11 12:20 ` Jiri Kosina [this message]
2018-06-14 13:37 ` [PATCH v2] " Zhouyang Jia
2018-06-25 13:16 ` Jiri Kosina
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=nycvar.YFH.7.76.1806111419480.6203@cbobk.fhfr.pm \
--to=jikos@kernel.org \
--cc=benjamin.tissoires@redhat.com \
--cc=jiazhouyang09@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®