linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: elo - fix an error code in elo_connect()
@ 2021-01-28  9:35 Dan Carpenter
  2021-02-17  4:37 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-01-28  9:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Gustavo A. R. Silva, Shaun Jackman, linux-input, kernel-janitors

If elo_setup_10() fails then this should return an error code instead
of success.

Fixes: fae3006e4b42 ("Input: elo - add support for non-pressure-sensitive touchscreens")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/input/touchscreen/elo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
index e0bacd34866a..4b2fb73da5e2 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -341,8 +341,10 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
 	switch (elo->id) {
 
 	case 0: /* 10-byte protocol */
-		if (elo_setup_10(elo))
+		if (elo_setup_10(elo)) {
+			err = -EINVAL;
 			goto fail3;
+		}
 
 		break;
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: elo - fix an error code in elo_connect()
  2021-01-28  9:35 [PATCH] Input: elo - fix an error code in elo_connect() Dan Carpenter
@ 2021-02-17  4:37 ` Dmitry Torokhov
  2021-02-17  8:24   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2021-02-17  4:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Gustavo A. R. Silva, Shaun Jackman, linux-input, kernel-janitors

Hi Dan,

On Thu, Jan 28, 2021 at 12:35:51PM +0300, Dan Carpenter wrote:
> If elo_setup_10() fails then this should return an error code instead
> of success.

Thank you for the patch.

> 
> Fixes: fae3006e4b42 ("Input: elo - add support for non-pressure-sensitive touchscreens")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/input/touchscreen/elo.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
> index e0bacd34866a..4b2fb73da5e2 100644
> --- a/drivers/input/touchscreen/elo.c
> +++ b/drivers/input/touchscreen/elo.c
> @@ -341,8 +341,10 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
>  	switch (elo->id) {
>  
>  	case 0: /* 10-byte protocol */
> -		if (elo_setup_10(elo))
> +		if (elo_setup_10(elo)) {
> +			err = -EINVAL;

Ideally we'd propagate error from elo_setup_10() and underlying code,
but we are not ready for it, as most serio code simply uses -1 for
errors. However I think that -EIO would suit better here. Please let me
know if you disagree, otherwise I'll fix it up on my side.

Thanks!

>  			goto fail3;
> +		}
>  
>  		break;
>  
> -- 
> 2.29.2
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: elo - fix an error code in elo_connect()
  2021-02-17  4:37 ` Dmitry Torokhov
@ 2021-02-17  8:24   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-02-17  8:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Gustavo A. R. Silva, Shaun Jackman, linux-input, kernel-janitors

On Tue, Feb 16, 2021 at 08:37:31PM -0800, Dmitry Torokhov wrote:
> Hi Dan,
> 
> On Thu, Jan 28, 2021 at 12:35:51PM +0300, Dan Carpenter wrote:
> > If elo_setup_10() fails then this should return an error code instead
> > of success.
> 
> Thank you for the patch.
> 
> > 
> > Fixes: fae3006e4b42 ("Input: elo - add support for non-pressure-sensitive touchscreens")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/input/touchscreen/elo.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
> > index e0bacd34866a..4b2fb73da5e2 100644
> > --- a/drivers/input/touchscreen/elo.c
> > +++ b/drivers/input/touchscreen/elo.c
> > @@ -341,8 +341,10 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
> >  	switch (elo->id) {
> >  
> >  	case 0: /* 10-byte protocol */
> > -		if (elo_setup_10(elo))
> > +		if (elo_setup_10(elo)) {
> > +			err = -EINVAL;
> 
> Ideally we'd propagate error from elo_setup_10() and underlying code,
> but we are not ready for it, as most serio code simply uses -1 for
> errors. However I think that -EIO would suit better here. Please let me
> know if you disagree, otherwise I'll fix it up on my side.
> 

-EIO is fine.  Thanks!

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-17  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28  9:35 [PATCH] Input: elo - fix an error code in elo_connect() Dan Carpenter
2021-02-17  4:37 ` Dmitry Torokhov
2021-02-17  8:24   ` Dan Carpenter

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).