Skip to contentSkip to conversation

staging: iio: light: Fix compiler warning in tsl2563.c

PATCH Maxin B. John 2 participants 6 messages Sep 2, 2011 – Oct 24, 2011 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw
Quoted 3 lines

Don't overwrite the error code. For example, the lower layers can return -EAGAIN and that's more useful than just returning -EIO every time.

Ahh.. Thanks a lot for explaining this.

Quoted 3 lines

Your fix works, but it's not very clean. Just add a "*id = ret;" line before the "return 0;" and that's it. (It doesn't make sense to pass a pointer to "id" and not use it).

Dan, yes, I agree with you. This fix is much much better than what I had in my mind.

Quoted 1 line

Yikes - I wonder why my various compilers don't throw that up.

I guess, in "iio-blue.git" tree, the 'id = 0' suppresses this warning.

---

drivers/staging/iio/light/tsl2563.c +1 -1
index f25243b..55012ff 100644
@@ -226,7 +226,7 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id)
 	ret = i2c_smbus_read_byte_data(client, TSL2563_CMD | TSL2563_REG_ID);
 	if (ret < 0)
 		return ret;
-
+	*id = ret;
 	return 0;
 }
 
#1 lore raw
Quoted 5 lines · Maxin B. John
Quoted 3 lines

Don't overwrite the error code. For example, the lower layers can return -EAGAIN and that's more useful than just returning -EIO every time.

Ahh.. Thanks a lot for explaining this.

Quoted 8 lines
Quoted 3 lines

Your fix works, but it's not very clean. Just add a "*id = ret;" line before the "return 0;" and that's it. (It doesn't make sense to pass a pointer to "id" and not use it).

Dan, yes, I agree with you. This fix is much much better than what I had in my mind.

Quoted 1 line

Yikes - I wonder why my various compilers don't throw that up.

I guess, in "iio-blue.git" tree, the 'id = 0' suppresses this warning.

That'd do it. oops.

Ideally keep the white space but doesn't really matter. Either send on to Greg directly or I'll add it to iio-blue and send on with the next fixes series - probably this afternoon.

Quoted 2 lines
Quoted 15 lines

---

drivers/staging/iio/light/tsl2563.c +1 -1
index f25243b..55012ff 100644
@@ -226,7 +226,7 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id)
 	ret = i2c_smbus_read_byte_data(client, TSL2563_CMD | TSL2563_REG_ID);
 	if (ret < 0)
 		return ret;
-
+	*id = ret;
 	return 0;
 }
 
#2 lore raw

Hi,

Quoted 12 lines · Jonathan Cameron
Quoted 11 lines · Maxin B. John
Quoted 3 lines

Don't overwrite the error code. =A0For example, the lower layers can return -EAGAIN and that's more useful than just returning -EIO every time.

Ahh.. Thanks a lot for explaining this.

Quoted 3 lines

Your fix works, but it's not very clean. =A0Just add a "*id =3D ret;" line before the "return 0;" and that's it. =A0(It doesn't make sense to pass a pointer to "id" and not use it).

Dan, yes, I agree with you. This fix is much much better than what I had in my mind.

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Yikes - I wonder why my various compilers don't throw that up.

I guess, in "iio-blue.git" tree, the 'id =3D 0' suppresses this warning.

That'd do it. oops.

Ideally keep the white space but doesn't really matter. Either send on to Greg directly or I'll add it to iio-blue and send on with the next fix=

es

Quoted 5 lines

series - probably this afternoon.

Quoted 2 lines

Sorry for the delay in replying to this mail. I am curious about the status of this patch. I couldn't locate this patch at iio-blue.git as it is not present in kernel.org now
(http://git.kernel.org/?p=3Dlinux/kernel/git/jic23/iio-blue.git;a=3Dsummary=
)
Please ignore this mail if you have already added this patch to your tree.

Quoted 2 lines

drivers/staging/iio/l=

Quoted 2 lines

---

drivers/staging/iio/l= renamed from drivers/staging/iio/light/tsl2563.c +0 -0

ight/tsl2563.c

Quoted 4 lines

drivers/staging/iio/light/tsl2563.c static int tsl2563_read_id(struct tsl2563_chip *chip=

Quoted 4 lines

index f25243b..55012ff 100644

drivers/staging/iio/light/tsl2563.c +0 -0
@@ -226,7 +226,7 @@ static int tsl2563_read_id(struct tsl2563_chip *chip=

, u8 *id)

Quoted 1 line
Quoted 1 line

=A0 =A0 =A0 ret =3D i2c_smbus_read_byte_data(client, TSL2563_CMD | TSL25=

63_REG_ID);

Quoted 10 lines
Quoted 8 lines

=A0 =A0 =A0 if (ret < 0)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 return ret;
-
+ =A0 =A0 *id =3D ret;
=A0 =A0 =A0 return 0;
=A0}

Warm Regards,
Maxin B. John

#3 lore raw
Quoted 24 lines · Maxin B John

Hi,

Quoted 21 lines · Jonathan Cameron
Quoted 5 lines · Maxin B. John
Quoted 3 lines

Don't overwrite the error code. For example, the lower layers can return -EAGAIN and that's more useful than just returning -EIO every time.

Ahh.. Thanks a lot for explaining this.

Quoted 8 lines
Quoted 3 lines

Your fix works, but it's not very clean. Just add a "*id = ret;" line before the "return 0;" and that's it. (It doesn't make sense to pass a pointer to "id" and not use it).

Dan, yes, I agree with you. This fix is much much better than what I had in my mind.

Quoted 1 line

Yikes - I wonder why my various compilers don't throw that up.

I guess, in "iio-blue.git" tree, the 'id = 0' suppresses this warning.

That'd do it. oops.

Ideally keep the white space but doesn't really matter. Either send on to Greg directly or I'll add it to iio-blue and send on with the next fixes series - probably this afternoon.

Quoted 2 lines
Quoted 8 lines
Quoted 2 lines

Sorry for the delay in replying to this mail. I am curious about the status of this patch. I couldn't locate this patch at iio-blue.git as it is not present in kernel.org now
(http://git.kernel.org/?p=linux/kernel/git/jic23/iio-blue.git;a=summary)
Please ignore this mail if you have already added this patch to your tree.

Ah, sorry I slipped up here and should have noticed it didn't go directly to Greg. Just to check, with everyone I have author as Dan, reporter as Maxin and have signed off myself (it's going through my tree anyway now).

I think from looking back it was Dan's suggestion in response to Maxin's patch. Hence convention would be a sign off from Dan and perhaps an Ack from Maxin?

Jonathan

Quoted 1 line
Quoted 1 line

From c33a01010decf686f5f2984d2ed04c1a70e18bc3 Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
Date: Mon, 24 Oct 2011 09:46:32 +0100
Subject: [PATCH] staging:iio:light:tsl2563 missing setting of id in get id
function.

---
 drivers/staging/iio/light/tsl2563.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/iio/light/tsl2563.c +2 -0
index 5cee5ca..45d04a1 100644
@@ -227,6 +227,8 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id)
 	if (ret < 0)
 		return ret;
 
+	*id = ret;
+
 	return 0;
 }
 
Signature · 1 line
1.7.7

A message that is not in the archive (sent off-list or not yet received): 20111024090143.GB3526@mwanda

#5 lore raw
Quoted 19 lines · Dan Carpenter
Quoted 9 lines · Jonathan Cameron
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Sorry for the delay in replying to this mail. I am curious about the status of this patch. I couldn't locate this patch at iio-blue.git as it is not present in kernel.org now
(http://git.kernel.org/?p=linux/kernel/git/jic23/iio-blue.git;a=summary)
Please ignore this mail if you have already added this patch to your tree.

Quoted 8 lines

Ah, sorry I slipped up here and should have noticed it didn't go directly to Greg. Just to check, with everyone I have author as Dan, reporter as Maxin and have signed off myself (it's going through my tree anyway now).

I think from looking back it was Dan's suggestion in response to Maxin's patch. Hence convention would be a sign off from Dan and perhaps an Ack from Maxin?

Quoted 5 lines

Maxim is the author. He didn't resend this in the proper way so it was confusing... Can you give me a Reviewed-by tag?

Sure.

A message that is not in the archive (sent off-list or not yet received): CAMhs6Yz6B_imMAthjjpymXj1garYzjFdzXfEArUwztmpgL4_hg@mail.gmail.com

#7 lore raw
Quoted 42 lines · Maxin B John

Hi,

Quoted 39 lines · Jonathan Cameron
Quoted 24 lines · Maxin B John

Hi,

Quoted 21 lines · Jonathan Cameron
Quoted 5 lines · Maxin B. John
Quoted 3 lines

Don't overwrite the error code. For example, the lower layers can return -EAGAIN and that's more useful than just returning -EIO every time.

Ahh.. Thanks a lot for explaining this.

Quoted 8 lines
Quoted 3 lines

Your fix works, but it's not very clean. Just add a "*id = ret;" line before the "return 0;" and that's it. (It doesn't make sense to pass a pointer to "id" and not use it).

Dan, yes, I agree with you. This fix is much much better than what I had in my mind.

Quoted 1 line

Yikes - I wonder why my various compilers don't throw that up.

I guess, in "iio-blue.git" tree, the 'id = 0' suppresses this warning.

That'd do it. oops.

Ideally keep the white space but doesn't really matter. Either send on to Greg directly or I'll add it to iio-blue and send on with the next fixes series - probably this afternoon.

Quoted 2 lines
Quoted 8 lines
Quoted 2 lines

Sorry for the delay in replying to this mail. I am curious about the status of this patch. I couldn't locate this patch at iio-blue.git as it is not present in kernel.org now
(http://git.kernel.org/?p=linux/kernel/git/jic23/iio-blue.git;a=summary)
Please ignore this mail if you have already added this patch to your tree.

Ah, sorry I slipped up here and should have noticed it didn't go directly to Greg. Just to check, with everyone I have author as Dan, reporter as Maxin and have signed off myself (it's going through my tree anyway now).

Quoted 8 lines
Quoted 3 lines

I think from looking back it was Dan's suggestion in response to Maxin's patch. Hence convention would be a sign off from Dan and perhaps an Ack from Maxin?

Sounds good to me.

As Dan reckon's you are the author I'll switch that to a signed-off by.