mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] platform/x86: toshiba_haps: Remove unnecessary ret in toshiba_haps_resume()
@ 2026-07-31 15:00 Sang-Heon Jeon
  2026-10-05 15:37 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Sang-Heon Jeon @ 2026-07-31 15:00 UTC (permalink / raw)
  To: Azael Avalos, Hans de Goede, Ilpo Järvinen
  Cc: linux-kernel, platform-driver-x86

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@gmail.com>
---
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@gmail.com/
---

 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] platform/x86: toshiba_haps: Remove unnecessary ret in toshiba_haps_resume()
  2026-07-31 15:00 [PATCH v2] platform/x86: toshiba_haps: Remove unnecessary ret in toshiba_haps_resume() Sang-Heon Jeon
@ 2026-10-05 15:37 ` Ilpo Järvinen
  0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2026-10-05 15:37 UTC (permalink / raw)
  To: Azael Avalos, Hans de Goede, Sang-Heon Jeon
  Cc: linux-kernel, platform-driver-x86

On Sat, 01 Aug 2026 00:00:07 +0900, Sang-Heon Jeon wrote:

> 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.
> 
> [...]

Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also
fixes are mostly routed through for-next unless the fix is for a
commit introduced in the most recent cycle or is clearly a regression
fix.

The list of commits applied:
[1/1] platform/x86: toshiba_haps: Remove unnecessary ret in toshiba_haps_resume()
      commit: a3d87f9f5408c137895667475ac730bbae829360

--
 i.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-05 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-31 15:00 [PATCH v2] platform/x86: toshiba_haps: Remove unnecessary ret in toshiba_haps_resume() Sang-Heon Jeon
2026-10-05 15:37 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®