Re: [PATCH v9 2/2] input: joystick: Add ADC attached joystick driver.

From: Dmitry Torokhov
Date: Mon Sep 14 2020 - 16:35:50 EST


On Sun, Sep 06, 2020 at 02:09:28PM +0200, Artur Rojek wrote:
> Hi Andy,
>
> thanks for the review, replies inline.
>
> On 2020-09-06 11:22, Andy Shevchenko wrote:
> > On Sat, Sep 5, 2020 at 7:34 PM Artur Rojek <contact@xxxxxxxxxxxxxx>
> > wrote:
> >
> > > +static int adc_joystick_open(struct input_dev *dev)
> >
> > > +static void adc_joystick_close(struct input_dev *dev)
> >
> > Just wondering if this is protected against object lifetime cases.
> Can you clarify that in more details?

If there are lifetime issues they would be in input core, not individual
driver. But input core ensures that it calls close (if open was called
earlier) before doing input device teardown.

> >
> > ...
> >
> > > +err:
> >
> > err_fwnode_put: ?
> >
> > > + fwnode_handle_put(child);
> > > + return ret;
> >
> > ...
> >
> > > + /* Count how many channels we got. NULL terminated. */
> > > + for (i = 0; joy->chans[i].indio_dev; ++i) {
> > > + bits = joy->chans[i].channel->scan_type.storagebits;
> > > + if (!bits || (bits > 16)) {
> > > + dev_err(dev, "Unsupported channel storage
> > > size\n");
> >
> > > + return -EINVAL;
> >
> > -ERANGE?

/* Math result not representable */

? Seems not any better than -EINVAL.

Thanks.

--
Dmitry