[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZTbklpRhpMIPey2j@nixie71>
Date: Mon, 23 Oct 2023 16:24:38 -0500
From: Jeff LaBundy <jeff@...undy.com>
To: Thomas Weißschuh <thomas@...ch.de>
Cc: Anshul Dalal <anshulusr@...il.com>, linux-input@...r.kernel.org,
devicetree@...r.kernel.org,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Thomas Weißschuh <linux@...ssschuh.net>,
Shuah Khan <skhan@...uxfoundation.org>,
linux-kernel-mentees@...ts.linuxfoundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/2] input: joystick: driver for Adafruit Seesaw
Gamepad
Hi Thomas,
On Mon, Oct 23, 2023 at 07:55:52AM +0200, Thomas Weißschuh wrote:
[...]
> >> + err = i2c_master_send(client, write_buf, sizeof(write_buf));
> >> + if (err < 0)
> >> + return err;
> >
> > You correctly return err (or rather, ret) for negative values, but you should also
> > check that ret matches the size of the data sent. For 0 <= ret < sizeof(writebuf),
> > return -EIO.
>
> The driver did this originally.
> I then requested it to be removed as this case
> can never happen.
> i2c_master_send will either return size of(writebuf) or an error.
Great catch; indeed you are correct. Apologies for having missed this
in the change log; this is good to know in the future.
That being said, it's a moot point IMO; this driver seems like a good
candidate for regmap. If regmap cannot be made to work here for some
reason, then I'd like to at least see some wrapper functions to avoid
duplicate code and manual assignments to a buffer.
Kind regards,
Jeff LaBundy
Powered by blists - more mailing lists