Skip to contentSkip to conversation

atxp1: signed/unsigned char bug

PATCH New Alexey Dobriyan 3 participants 6 messages Jul 24, 2006 – Jul 27, 2006 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atxp1: signed/unsigned char bug

vid_to_reg() can return -1 and char can be unsigned.

Signed-off-by Alexey Dobriyan <adobriyan at gmail.com>

---

 drivers/hwmon/atxp1.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwmon/atxp1.c +1 -2
@@ -116,8 +116,7 @@ static ssize_t atxp1_storevcore(struct d
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;
-	char vid;
-	char cvid;
+	int vid, cvid;
 	unsigned int vcore;
 
 	client = to_i2c_client(dev);
#1 lore raw

PATCH 1/1 atxp1: signed/unsigned char bug

Hi Alexey,

Quoted 1 line

vid_to_reg() can return -1 and char can be unsigned.

What does it take for char be unsigned? Never seen that.

Quoted 9 lines
Signed-off-by Alexey Dobriyan <adobriyan at gmail.com>

---

 drivers/hwmon/atxp1.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

drivers/hwmon/atxp1.c static ssize_t atxp1_storevcore(struct d · line 122

Quoted 9 lines
drivers/hwmon/atxp1.c +1 -2
@@ -116,8 +116,7 @@ static ssize_t atxp1_storevcore(struct d
 {
 	struct atxp1_data *data;
 	struct i2c_client *client;
-	char vid;
-	char cvid;
+	int vid, cvid;
 	unsigned int vcore;
 
 	client = to_i2c_client(dev);

Whatever, this looks better with ints, I agree. I'll take that patch, unless Sebastian objects.

Signature · 1 line
Jean Delvare
#2 lore raw

PATCH 1/1 atxp1: signed/unsigned char bug

In reply to Alexey Dobriyan
Quoted 3 lines · Jean Delvare
Quoted 1 line

vid_to_reg() can return -1 and char can be unsigned.

What does it take for char be unsigned? Never seen that.

Cross-gcc for arm here. That's how it was noticed. Or -funsigned-char gcc flag.

#3 lore raw

PATCH 1/1 atxp1: signed/unsigned char bug

In reply to Alexey Dobriyan
Quoted 3 lines · Jean Delvare

Whatever, this looks better with ints, I agree. I'll take that patch, unless Sebastian objects.

No, I'm fine with that.

Bye,
Sebastian

#4 lore raw

PATCH 1/1 atxp1: signed/unsigned char bug

In reply to Alexey Dobriyan
Quoted 6 lines · Jean Delvare
Quoted 3 lines
Quoted 1 line

vid_to_reg() can return -1 and char can be unsigned.

What does it take for char be unsigned? Never seen that.

Cross-gcc for arm here. That's how it was noticed.

I'd call it a bug.

Quoted 1 line

Or -funsigned-char gcc flag.

Irrelevant as far as the kernel compilation goes - but thanks for the hint.

I take the patch anyway.

Signature · 1 line
Jean Delvare
#5 lore raw

PATCH 1/1 atxp1: signed/unsigned char bug

In reply to Alexey Dobriyan
Quoted 8 lines · Jean Delvare
Quoted 6 lines · Jean Delvare
Quoted 3 lines
Quoted 1 line

vid_to_reg() can return -1 and char can be unsigned.

What does it take for char be unsigned? Never seen that.

Cross-gcc for arm here. That's how it was noticed.

I'd call it a bug.

C standard explicitly says that "char" equivalence to either "signed char" or "unsigned char" is implementation defined. But, yes, it's confusing.