Skip to contentSkip to conversation

platform/surface: platform_profile: Propagate error if profile registration fails

PATCH In review Armin Wolf 3 participants 3 messages Oct 14, 2023 – Oct 18, 2023

Subsystems (3)
lore
Share & tools
lore

Armin Wolf

author
#0 lore raw

PATCH 1/1 platform/surface: platform_profile: Propagate error if profile registration fails

If platform_profile_register() fails, the driver does not propagate the error, but instead probes successfully. This means when the driver unbinds, the a warning might be issued by platform_profile_remove().

Fix this by propagating the error back to the caller of surface_platform_profile_probe().

Compile-tested only.

Fixes b78b4982d763 ("platform/surface: Add platform profile driver")
---
 drivers/platform/surface/surface_platform_profile.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/surface/surface_platform_profile.c +1 -2
index f433a13c3689..a5a3941b3f43 100644
@@ -159,8 +159,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
 	set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices);
 	set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices);
 
-	platform_profile_register(&tpd->handler);
-	return 0;
+	return platform_profile_register(&tpd->handler);
 }
 
 static void surface_platform_profile_remove(struct ssam_device *sdev)

--
2.39.2

maintainer Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Armin Wolf

If platform_profile_register() fails, the driver does not propagate the error, but instead probes successfully. This means when the driver unbinds, the a warning might be issued by platform_profile_remove().

Fix this by propagating the error back to the caller of surface_platform_profile_probe().

Compile-tested only.

Fixes b78b4982d763 ("platform/surface: Add platform profile driver")

Thanks! Works fine on my Surface Book 2.

Quoted 21 lines
---
  drivers/platform/surface/surface_platform_profile.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/surface/surface_platform_profile.c +1 -3
index f433a13c3689..a5a3941b3f43 100644
@@ -159,8 +159,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
  	set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices);
  	set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices);
 
-	platform_profile_register(&tpd->handler);
-	return 0;
+	return platform_profile_register(&tpd->handler);
  }
 
  static void surface_platform_profile_remove(struct ssam_device *sdev)
--

2.39.2

#2 lore raw
In reply to Armin Wolf

Hi,

Quoted 11 lines · Armin Wolf

If platform_profile_register() fails, the driver does not propagate the error, but instead probes successfully. This means when the driver unbinds, the a warning might be issued by platform_profile_remove().

Fix this by propagating the error back to the caller of surface_platform_profile_probe().

Compile-tested only.

Fixes b78b4982d763 ("platform/surface: Add platform profile driver")

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

Note it will show up in the pdx86 fixes branch once I've pushed my local branch there, which might take a while.

I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle.

Regards,

Hans

Quoted 21 lines
---
 drivers/platform/surface/surface_platform_profile.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/surface/surface_platform_profile.c +1 -3
index f433a13c3689..a5a3941b3f43 100644
@@ -159,8 +159,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
 	set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices);
 	set_bit(PLATFORM_PROFILE_PERFORMANCE, tpd->handler.choices);
 
-	platform_profile_register(&tpd->handler);
-	return 0;
+	return platform_profile_register(&tpd->handler);
 }
 
 static void surface_platform_profile_remove(struct ssam_device *sdev)
--

2.39.2