Skip to contentSkip to conversation

platform/x86: thinkpad_acpi: correct palmsensor error checking

PATCH In review Mark Pearson 3 participants 5 messages Dec 30, 2020 – Jan 4, 2021 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: thinkpad_acpi: correct palmsensor error checking

The previous commit adding functionality for the palm sensor had a mistake which meant the error conditions on initialisation was not checked correctly. On some older platforms this meant that if the sensor wasn't available an error would be returned and the driver would fail to load.

This commit corrects the error condition. Many thanks to Mario Oenning for reporting and determining the issue

---
 drivers/platform/x86/thinkpad_acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +2 -2
index e03df2881dc6..c102657b3eb3 100644
@@ -9951,9 +9951,9 @@ static int tpacpi_proxsensor_init(struct ibm_init_struct *iibm)
 	if ((palm_err == -ENODEV) && (lap_err == -ENODEV))
 		return 0;
 	/* Otherwise, if there was an error return it */
-	if (palm_err && (palm_err != ENODEV))
+	if (palm_err && (palm_err != -ENODEV))
 		return palm_err;
-	if (lap_err && (lap_err != ENODEV))
+	if (lap_err && (lap_err != -ENODEV))
 		return lap_err;
 
 	if (has_palmsensor) {
Signature · 1 line
2.28.0
#1 lore raw

Hi,

Quoted 9 lines · Mark Pearson

The previous commit adding functionality for the palm sensor had a mistake which meant the error conditions on initialisation was not checked correctly. On some older platforms this meant that if the sensor wasn't available an error would be returned and the driver would fail to load.

This commit corrects the error condition. Many thanks to Mario Oenning for reporting and determining the issue

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Since this is a bugfix I will also cherry-pick this patch to the fixes branch and include it in an upcoming fixes pull-req for 5.11.

Regards,

Hans

Quoted 21 lines
---
 drivers/platform/x86/thinkpad_acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +2 -2
index e03df2881dc6..c102657b3eb3 100644
@@ -9951,9 +9951,9 @@ static int tpacpi_proxsensor_init(struct ibm_init_struct *iibm)
 	if ((palm_err == -ENODEV) && (lap_err == -ENODEV))
 		return 0;
 	/* Otherwise, if there was an error return it */
-	if (palm_err && (palm_err != ENODEV))
+	if (palm_err && (palm_err != -ENODEV))
 		return palm_err;
-	if (lap_err && (lap_err != ENODEV))
+	if (lap_err && (lap_err != -ENODEV))
 		return lap_err;
 
 	if (has_palmsensor) {
#2 lore raw
In reply to Mark Pearson
Quoted 8 lines · Mark Pearson

The previous commit adding functionality for the palm sensor had a mistake which meant the error conditions on initialisation was not checked correctly. On some older platforms this meant that if the sensor wasn't available an error would be returned and the driver would fail to load.

This commit corrects the error condition. Many thanks to Mario Oenning for reporting and determining the issue

Hint to the future (maybe Hans will fix this while it's in his review queue):
we have a Reported-by tag. Of course if a person would like to avoid it, then it's fine.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Hi,

Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Mark Pearson

The previous commit adding functionality for the palm sensor had a mistake which meant the error conditions on initialisation was not checked correctly. On some older platforms this meant that if the sensor wasn't available an error would be returned and the driver would fail to load.

Quoted 6 lines
Quoted 2 lines

This commit corrects the error condition. Many thanks to Mario Oenning for reporting and determining the issue

Hint to the future (maybe Hans will fix this while it's in his review queue):
we have a Reported-by tag. Of course if a person would like to avoid it, then it's fine.

I did notice this too, but I did not fix it. For future patches the right thing to do is to ask the reporter if he is ok with a Reported-by tag being added (which will expose their email to the world) and then proceed depending on their answer, at least that is what I usually do. Although sometimes I do just add the Reported-by tag, esp. if the email has been send to a (couple of) lists, so the email already has been exposed to a large audience.

Regards,

Hans

#4 lore raw
Quoted 19 lines · Hans de Goede

Hi,

Quoted 9 lines · Andy Shevchenko
Quoted 6 lines · Mark Pearson

The previous commit adding functionality for the palm sensor had a mistake which meant the error conditions on initialisation was not checked correctly. On some older platforms this meant that if the sensor wasn't available an error would be returned and the driver would fail to load.

Quoted 6 lines
Quoted 2 lines

This commit corrects the error condition. Many thanks to Mario Oenning for reporting and determining the issue

Hint to the future (maybe Hans will fix this while it's in his review queue): we have a Reported-by tag. Of course if a person would like to avoid it, then it's fine.

Quoted 8 lines

I did notice this too, but I did not fix it. For future patches the right thing to do is to ask the reporter if he is ok with a Reported-by tag being added (which will expose their email to the world) and then proceed depending on their answer, at least that is what I usually do. Although sometimes I do just add the Reported-by tag, esp. if the email has been send to a (couple of) lists, so the email already has been exposed to a large audience.

Ack - thanks all. I wasn't aware of the reported-by etiquette :)

Probably a good one to know about....I'm sure this won't be the last issue reported against a Lenovo system!

Mark