diff mbox

[4/4] em28xx-i2c: remove duplicate error printing code from em28xx_i2c_xfer()

Message ID 1390168117-2925-5-git-send-email-fschaefer.oss@googlemail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Frank Schäfer Jan. 19, 2014, 9:48 p.m. UTC
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/usb/em28xx/em28xx-i2c.c |   11 +++--------
 1 Datei geändert, 3 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)

Comments

Mauro Carvalho Chehab Feb. 4, 2014, 6:50 p.m. UTC | #1
Em Sun, 19 Jan 2014 22:48:37 +0100
Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:

> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
> ---
>  drivers/media/usb/em28xx/em28xx-i2c.c |   11 +++--------
>  1 Datei geändert, 3 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
> index a26d7d4..1a514ca 100644
> --- a/drivers/media/usb/em28xx/em28xx-i2c.c
> +++ b/drivers/media/usb/em28xx/em28xx-i2c.c
> @@ -535,14 +535,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
>  			 * This code is only called during device probe.
>  			 */
>  			rc = i2c_check_for_device(i2c_bus, addr);
> -			if (rc < 0) {
> -				if (rc == -ENXIO) {
> -					if (i2c_debug > 1)
> -						printk(KERN_CONT " no device\n");
> -				} else {
> -					if (i2c_debug > 1)
> -						printk(KERN_CONT " ERROR: %i\n", rc);
> -				}
> +			if (rc == -ENXIO) {
> +				if (i2c_debug > 1)
> +					printk(KERN_CONT " no device\n");

Even if the previous patch were accepted, this one is wrong, as -ENXIO
doesn't always mean that there's no device. Also, other return codes
may happen here (like -EIO).

>  				rt_mutex_unlock(&dev->i2c_bus_lock);
>  				return rc;
>  			}
Frank Schäfer Feb. 9, 2014, 6:38 p.m. UTC | #2
Am 04.02.2014 19:50, schrieb Mauro Carvalho Chehab:
> Em Sun, 19 Jan 2014 22:48:37 +0100
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>
>> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>> ---
>>  drivers/media/usb/em28xx/em28xx-i2c.c |   11 +++--------
>>  1 Datei geändert, 3 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-)
>>
>> diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
>> index a26d7d4..1a514ca 100644
>> --- a/drivers/media/usb/em28xx/em28xx-i2c.c
>> +++ b/drivers/media/usb/em28xx/em28xx-i2c.c
>> @@ -535,14 +535,9 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
>>  			 * This code is only called during device probe.
>>  			 */
>>  			rc = i2c_check_for_device(i2c_bus, addr);
>> -			if (rc < 0) {
>> -				if (rc == -ENXIO) {
>> -					if (i2c_debug > 1)
>> -						printk(KERN_CONT " no device\n");
>> -				} else {
>> -					if (i2c_debug > 1)
>> -						printk(KERN_CONT " ERROR: %i\n", rc);
>> -				}
>> +			if (rc == -ENXIO) {
>> +				if (i2c_debug > 1)
>> +					printk(KERN_CONT " no device\n");
> Even if the previous patch were accepted, this one is wrong, as -ENXIO
> doesn't always mean that there's no device. Also, other return codes
> may happen here (like -EIO).
Mauro... please read the patch and the corresponding code again.
You will notice that there is absolutely no functional change.
The patch just removes duplicate code.
Hence your comment makes no sense.

If you insist on the weird -ENODEV/-ENXIO inconsistency you've
introduced, then of course the patch needs to be rebased.

>>  				rt_mutex_unlock(&dev->i2c_bus_lock);
>>  				return rc;
>>  			}

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index a26d7d4..1a514ca 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -535,14 +535,9 @@  static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
 			 * This code is only called during device probe.
 			 */
 			rc = i2c_check_for_device(i2c_bus, addr);
-			if (rc < 0) {
-				if (rc == -ENXIO) {
-					if (i2c_debug > 1)
-						printk(KERN_CONT " no device\n");
-				} else {
-					if (i2c_debug > 1)
-						printk(KERN_CONT " ERROR: %i\n", rc);
-				}
+			if (rc == -ENXIO) {
+				if (i2c_debug > 1)
+					printk(KERN_CONT " no device\n");
 				rt_mutex_unlock(&dev->i2c_bus_lock);
 				return rc;
 			}