x86: thinkpad_acpi: Handle return error.
PATCH 1/1 x86: thinkpad_acpi: Handle return error.
This patch is for handling a return error.
--- drivers/platform/x86/thinkpad_acpi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +12 -3
@@ -1237,9 +1237,11 @@ static int tpacpi_rfk_hook_set_block(void *data, bool blocked)/* try to set radio state */ res = (tp_rfk->ops->set_status)(blocked ?TPACPI_RFK_RADIO_OFF :TPACPI_RFK_RADIO_ON ); +if (res <0 ) +return res;/* and update the rfkill core with whatever the FW really did */ -tpacpi_rfk_update_swstate (tp_rfk); + res =tpacpi_rfk_update_swstate (tp_rfk);return (res <0 ) ? res :0 ; }
@@ -1371,7 +1373,10 @@ static ssize_t tpacpi_rfk_sysfs_enable_store(const enum tpacpi_rfk_id id, res = tpacpi_rfkill_switches[id]->ops->set_status ((!!t) ?TPACPI_RFK_RADIO_ON :TPACPI_RFK_RADIO_OFF ); -tpacpi_rfk_update_swstate (tpacpi_rfkill_switches[id]); +if (res <0 ) +return res; + + res =tpacpi_rfk_update_swstate (tpacpi_rfkill_switches[id]);return (res <0 ) ? res : count; }
@@ -1427,7 +1432,9 @@ static int tpacpi_rfk_procfs_write(const enum tpacpi_rfk_id id, char *buf) "enable" : "disable", tpacpi_rfkill_names[id]); res = (tpacpi_rfkill_switches[id]->ops->set_status)(status); -tpacpi_rfk_update_swstate (tpacpi_rfkill_switches[id]); +if (res <0 ) +return res; + res =tpacpi_rfk_update_swstate (tpacpi_rfkill_switches[id]); }return res;
@@ -3517,6 +3524,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)if (tp_features.hotkey_wlsw) res =add_to_attr_set (hotkey_dev_attributes, &dev_attr_hotkey_radio_sw.attr); +if (res) + goto err_exit; res =hotkey_init_tablet_mode ();if (res <0 )
Signature · 1 line
1.9.1
Quoted 12 lines · Arvind Yadav
This patch is for handling a return error.
Signed-off-by Arvind Yadav <[email protected]>--- drivers/platform/x86/thinkpad_acpi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)drivers/platform/x86/thinkpad_acpi.c +0
-0
drivers/platform/x86/thinkpad_acpi.c static int tpacpi_rfk_hook_set_block(void *data, bool blocked) · line 1240
Quoted 4 lines
drivers/platform/x86/thinkpad_acpi.c +0
-0@@ -1237,9 +1237,11 @@ static int tpacpi_rfk_hook_set_block(void *data, bool blocked)/* try to set radio state */ res = (tp_rfk->ops->set_status)(blocked ?TPACPI_RFK_RADIO_OFF :TPACPI_RFK_RADIO_ON );
Just in case: first parens are redundant here.
drivers/platform/x86/thinkpad_acpi.c static int tpacpi_rfk_hook_set_block(void *data, bool blocked) · line 1242
Quoted 2 lines
drivers/platform/x86/thinkpad_acpi.c +2
-0+if (res <0 ) +return res;
So, this changes behaviour. Before we call _rfk_update_swstate() independently on error code.
Care to explain in commit message how this change does / does not affect overall user experience?
Quoted 8 lines
drivers/platform/x86/thinkpad_acpi.c +1
-1/* and update the rfkill core with whatever the FW really did */ -tpacpi_rfk_update_swstate (tp_rfk); + res =tpacpi_rfk_update_swstate (tp_rfk);return (res <0 ) ? res :0 ; }
drivers/platform/x86/thinkpad_acpi.c static int __init hotkey_init(struct ibm_init_struct *iibm) · line 3531
Quoted 8 lines
drivers/platform/x86/thinkpad_acpi.c +2
-0@@ -3517,6 +3524,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)if (tp_features.hotkey_wlsw) res =add_to_attr_set (hotkey_dev_attributes, &dev_attr_hotkey_radio_sw.attr); +if (res) + goto err_exit; res =hotkey_init_tablet_mode ();if (res <0 )
Ditto for hotkey_init_tablet_mode().
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 20 lines · Andy Shevchenko
Quoted 12 lines · Arvind Yadav
This patch is for handling a return error.
Signed-off-by Arvind Yadav <[email protected]>--- drivers/platform/x86/thinkpad_acpi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)drivers/platform/x86/thinkpad_acpi.c +0
-0drivers/platform/x86/thinkpad_acpi.c static int tpacpi_rfk_hook_set_block(void *data, bool blocked) · line 1240
Quoted 4 lines
drivers/platform/x86/thinkpad_acpi.c +0
-0@@ -1237,9 +1237,11 @@ static int tpacpi_rfk_hook_set_block(void *data, bool blocked)/* try to set radio state */ res = (tp_rfk->ops->set_status)(blocked ?TPACPI_RFK_RADIO_OFF :TPACPI_RFK_RADIO_ON );Just in case: first parens are redundant here.
Quoted 8 lines
drivers/platform/x86/thinkpad_acpi.c static int tpacpi_rfk_hook_set_block(void *data, bool blocked) · line 1242
Quoted 2 lines
drivers/platform/x86/thinkpad_acpi.c +2
-0+if (res <0 ) +return res;So, this changes behaviour. Before we call
_rfk_update_swstate()independently on error code.Care to explain in commit message how this change does / does not affect overall user experience?
Arvind has made a number of similar such changes throughout the tree, I presume with some automation. In this case, since there is no indication of a particular manifestation of this bug on hardware, I will presume the same approach was taken here. I'm dropping this patch as "changes requested" because at the very least this needs a commit log which documents the problem manifested and why the behavioral change is appropriate.
Signature · 6 lines
Darren Hart VMware Open Source Technology Center ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot