Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1296985 > unrolled thread

Re: [PATCH] input:touchscreen:Properly check touchscreen information is read in ads7846_probe

Started byDmitry Torokhov <dmitry.torokhov@gmail.com>
First post2015-12-22 20:00 +0100
Last post2015-12-22 20:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] input:touchscreen:Properly check touchscreen information  is read in ads7846_probe Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-12-22 20:00 +0100

#1296985 — Re: [PATCH] input:touchscreen:Properly check touchscreen information is read in ads7846_probe

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2015-12-22 20:00 +0100
SubjectRe: [PATCH] input:touchscreen:Properly check touchscreen information is read in ads7846_probe
Message-ID<qIAka-7Cc-21@gated-at.bofh.it>
On Tue, Dec 22, 2015 at 9:58 AM, Nicholas Krause <xerofoify@gmail.com> wrote:
> This properly checks if touchscreen information is read before
> allocating a sysfs_group of files for this device's device
> structure's kobject(s) and if we fail to read the information
> successfully then we must continue with the error path for
> the error occurred by freeing up resources allocating by
> ads7846_probe before returning the error code returned
> by this function call to the caller of ads7846_probe.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/input/touchscreen/ads7846.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index a61b215..d8150a9 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -1412,9 +1412,12 @@ static int ads7846_probe(struct spi_device *spi)
>          * the touchscreen, in case it's not connected.
>          */
>         if (ts->model == 7845)
> -               ads7845_read12_ser(&spi->dev, PWRDOWN);
> +               err = ads7845_read12_ser(&spi->dev, PWRDOWN);
>         else
> -               (void) ads7846_read12_ser(&spi->dev, READ_12BIT_SER(vaux));
> +               err = ads7846_read12_ser(&spi->dev, READ_12BIT_SER(vaux));
> +
> +       if (err)
> +               goto err_remove_hwmon;

Positive return value from ads784*_read12_ser() does not indicate
error. Also note that when someone takes care annotating an
expressions as "(void)" they explicitly indicate that return value
should be ignored. For details about why it has been done here you'd
have to ask Anatolij Gustschin.

>
>         err = sysfs_create_group(&spi->dev.kobj, &ads784x_attr_group);
>         if (err)
> --
> 2.5.0
>

Nick, it has been proven time and again that your submissions are not
useful, please refrain from sending me patches.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web