[PATCH v2] platform/x86: toshiba_haps: Remove unnecessary ret in toshiba_haps_resume()

From: Sang-Heon Jeon

Date: Fri Jul 31 2026 - 11:11:49 EST


The return value of toshiba_haps_protection_level() is ignored because
ret is immediately overwritten by the toshiba_haps_reset_protection()
call.

And ret is only used by the check, which has no effect because both
branches return the same value. So remove the check and ret, and
return the value directly.

No functional change.

Found by the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@xxxxxxxxx>
---
The platform/x86 patch of the treewide v1 series [1] is posted
separately. You can find the Coccinelle script in v1 [1].

---
Changes from v1 [1]
- Change base to platform-drivers-x86/for-next
- Filter only toshiba_haps changes
- Remove the unused ret variable
- Update the subject

[1] https://lore.kernel.org/all/20260723184538.3888637-1-ekffu200098@xxxxxxxxx/
---

drivers/platform/x86/toshiba_haps.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/x86/toshiba_haps.c b/drivers/platform/x86/toshiba_haps.c
index c6633b74029f..b2eb91929d1d 100644
--- a/drivers/platform/x86/toshiba_haps.c
+++ b/drivers/platform/x86/toshiba_haps.c
@@ -244,18 +244,13 @@ static int toshiba_haps_suspend(struct device *device)
static int toshiba_haps_resume(struct device *device)
{
struct toshiba_haps_dev *haps = dev_get_drvdata(device);
- int ret;

/* Set the stored protection level */
- ret = toshiba_haps_protection_level(haps->acpi_dev->handle,
- haps->protection_level);
+ toshiba_haps_protection_level(haps->acpi_dev->handle,
+ haps->protection_level);

/* Reset the protection on resume */
- ret = toshiba_haps_reset_protection(haps->acpi_dev->handle);
- if (ret != 0)
- return ret;
-
- return ret;
+ return toshiba_haps_reset_protection(haps->acpi_dev->handle);
}
#endif

--
2.43.0