linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jikos@kernel.org>
Cc: "Arve Hjønnevåg" <arve@android.com>,
	"Jaikumar Ganesh" <jaikumarg@android.com>,
	"Krzysztof Kozlowski" <k.kozlowski@samsung.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"James C Boyd" <jcboyd.dev@gmail.com>,
	"Karl Relton" <karllinuxtest.relton@ntlworld.com>,
	"David Herrmann" <dh.herrmann@gmail.com>,
	"Olivier Gay" <ogay@logitech.com>,
	"Ross Skaliotis" <rskaliotis@gmail.com>,
	"Jamie Lentin" <jm@lentin.co.uk>,
	"Benjamin Tissoires" <benjamin.tissoires@gmail.com>,
	"Andreas Fleig" <andreasfleig@gmail.com>,
	"Alexey Khoroshilov" <khoroshilov@ispras.ru>,
	"Peter Wu" <peter@lekensteyn.nl>,
	"Goffredo Baroncelli" <kreijack@inwind.it>,
	"Mathieu Magnaudet" <mathieu.magnaudet@gmail.com>,
	"Brent Adam" <brentadamdev@gmail.com>,
	"Yang Bo" <linuxsea@163.com>,
	"Seth Forshee" <seth.forshee@canonical.com>,
	"Andrew Duggan" <aduggan@synaptics.com>,
	"Dan Carpenter" <dan.carpenter@oracle.com>
Subject: Re: [PATCH] HID: hid-input: allow input_configured callback return errors
Date: Sat, 26 Sep 2015 20:48:57 +0300	[thread overview]
Message-ID: <5606DA89.9060505@redhat.com> (raw)
In-Reply-To: <20150925231451.GA40951@dtor-ws>

On 09/26/2015 02:14 AM, Dmitry Torokhov wrote:
> When configuring input device via input_configured callback we may
> encounter errors (for example input_mt_init_slots() may fail). Instead
> of continuing with half-initialized input device let's allow driver
> indicate failures.
>
> diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
> index b905d50..85ac435 100644
> --- a/drivers/hid/hid-uclogic.c
> +++ b/drivers/hid/hid-uclogic.c
> @@ -731,7 +731,7 @@ static int uclogic_input_mapping(struct hid_device *hdev, struct hid_input *hi,
>   	return 0;
>   }
>
> -static void uclogic_input_configured(struct hid_device *hdev,
> +static int uclogic_input_configured(struct hid_device *hdev,
>   		struct hid_input *hi)
>   {
>   	char *name;
> @@ -741,7 +741,7 @@ static void uclogic_input_configured(struct hid_device *hdev,
>
>   	/* no report associated (HID_QUIRK_MULTI_INPUT not set) */
>   	if (!hi->report)
> -		return;
> +		return 0;
>
>   	field = hi->report->field[0];
>
> @@ -774,6 +774,8 @@ static void uclogic_input_configured(struct hid_device *hdev,
>   			hi->input->name = name;
>   		}
>   	}
> +
> +	return 0;
>   }
>
>   /**

The hid-uclogic.c change looks perfectly fine to me.

Thank you, Dmitri.

The next step would be to report devm_kzalloc failure instead of ignoring it.

Nick

  parent reply	other threads:[~2015-09-26 17:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 23:14 [PATCH] HID: hid-input: allow input_configured callback return errors Dmitry Torokhov
2015-09-26 15:16 ` David Herrmann
2015-09-28  0:23   ` Dmitry Torokhov
2015-09-28 10:10     ` David Herrmann
2015-09-28 22:22       ` Andrew Duggan
2015-09-26 17:48 ` Nikolai Kondrashov [this message]
2015-09-29 22:52 ` [PATCH v2] " Dmitry Torokhov
2015-09-30  8:09   ` 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=5606DA89.9060505@redhat.com \
    --to=nikolai.kondrashov@redhat.com \
    --cc=aduggan@synaptics.com \
    --cc=andreasfleig@gmail.com \
    --cc=arve@android.com \
    --cc=benjamin.tissoires@gmail.com \
    --cc=brentadamdev@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dh.herrmann@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jaikumarg@android.com \
    --cc=jcboyd.dev@gmail.com \
    --cc=jikos@kernel.org \
    --cc=jm@lentin.co.uk \
    --cc=k.kozlowski@samsung.com \
    --cc=karllinuxtest.relton@ntlworld.com \
    --cc=khoroshilov@ispras.ru \
    --cc=kreijack@inwind.it \
    --cc=linuxsea@163.com \
    --cc=mathieu.magnaudet@gmail.com \
    --cc=ogay@logitech.com \
    --cc=peter@lekensteyn.nl \
    --cc=rskaliotis@gmail.com \
    --cc=seth.forshee@canonical.com \
    --cc=sre@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;
as well as URLs for NNTP newsgroup(s).