input:touchscreen:Properly check touchscreen information is read in ads7846_probe
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 19 lines · Nicholas Krause
This properly checks if touchscreen information is read before allocating a
sysfs_groupof 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 byads7846_probebefore returning the error code returned by this function call to the caller ofads7846_probe.Signed-off-by Nicholas Krause <[email protected]>--- drivers/input/touchscreen/ads7846.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/input/touchscreen/ads7846.c +0
-0@@ -1412,9 +1412,12 @@ static int ads7846_probe(struct spi_device *spi)* the touchscreen, in case it's not connected.
drivers/input/touchscreen/ads7846.c static int ads7846_probe(struct spi_device *spi) · line 1420
Quoted 10 lines
drivers/input/touchscreen/ads7846.c +5
-2*/ 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.
Quoted 6 lines
drivers/input/touchscreen/ads7846.c +0
-1err =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.
Signature · 1 line
Dmitry