From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753517AbbIZRtL (ORCPT ); Sat, 26 Sep 2015 13:49:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56900 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753445AbbIZRtI (ORCPT ); Sat, 26 Sep 2015 13:49:08 -0400 Message-ID: <5606DA89.9060505@redhat.com> Date: Sat, 26 Sep 2015 20:48:57 +0300 From: Nikolai Kondrashov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Dmitry Torokhov , Jiri Kosina CC: =?windows-1252?Q?Arve_Hj=F8nnev=E5g?= , Jaikumar Ganesh , Krzysztof Kozlowski , Sebastian Reichel , James C Boyd , Karl Relton , David Herrmann , Olivier Gay , Ross Skaliotis , Jamie Lentin , Benjamin Tissoires , Andreas Fleig , Alexey Khoroshilov , Peter Wu , Goffredo Baroncelli , Mathieu Magnaudet , Brent Adam , Yang Bo , Seth Forshee , Andrew Duggan , Dan Carpenter , Frank Praznik , Simon Wood , Antonio Ospite , JD Cole , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] HID: hid-input: allow input_configured callback return errors References: <20150925231451.GA40951@dtor-ws> In-Reply-To: <20150925231451.GA40951@dtor-ws> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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