linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/surface: platform_profile: Propagate error if profile registration fails
@ 2023-10-14 23:54 Armin Wolf
  2023-10-15 19:06 ` Maximilian Luz
  2023-10-18 13:32 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Armin Wolf @ 2023-10-14 23:54 UTC (permalink / raw)
  To: luzmaximilian
  Cc: hdegoede, ilpo.jarvinen, markgross, platform-driver-x86, linux-kernel

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")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/surface/surface_platform_profile.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c
index f433a13c3689..a5a3941b3f43 100644
--- a/drivers/platform/surface/surface_platform_profile.c
+++ b/drivers/platform/surface/surface_platform_profile.c
@@ -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


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

* Re: [PATCH] platform/surface: platform_profile: Propagate error if profile registration fails
  2023-10-14 23:54 [PATCH] platform/surface: platform_profile: Propagate error if profile registration fails Armin Wolf
@ 2023-10-15 19:06 ` Maximilian Luz
  2023-10-18 13:32 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Maximilian Luz @ 2023-10-15 19:06 UTC (permalink / raw)
  To: Armin Wolf
  Cc: hdegoede, ilpo.jarvinen, markgross, platform-driver-x86, linux-kernel

On 10/15/23 01:54, Armin Wolf wrote:
> 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")
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Thanks! Works fine on my Surface Book 2.

Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
Tested-by: Maximilian Luz <luzmaximilian@gmail.com>

> ---
>   drivers/platform/surface/surface_platform_profile.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c
> index f433a13c3689..a5a3941b3f43 100644
> --- a/drivers/platform/surface/surface_platform_profile.c
> +++ b/drivers/platform/surface/surface_platform_profile.c
> @@ -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
> 

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

* Re: [PATCH] platform/surface: platform_profile: Propagate error if profile registration fails
  2023-10-14 23:54 [PATCH] platform/surface: platform_profile: Propagate error if profile registration fails Armin Wolf
  2023-10-15 19:06 ` Maximilian Luz
@ 2023-10-18 13:32 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2023-10-18 13:32 UTC (permalink / raw)
  To: Armin Wolf, luzmaximilian
  Cc: ilpo.jarvinen, markgross, platform-driver-x86, linux-kernel

Hi,

On 10/15/23 01:54, Armin Wolf wrote:
> 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")
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

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



> ---
>  drivers/platform/surface/surface_platform_profile.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c
> index f433a13c3689..a5a3941b3f43 100644
> --- a/drivers/platform/surface/surface_platform_profile.c
> +++ b/drivers/platform/surface/surface_platform_profile.c
> @@ -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
> 


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

end of thread, other threads:[~2023-10-18 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-14 23:54 [PATCH] platform/surface: platform_profile: Propagate error if profile registration fails Armin Wolf
2023-10-15 19:06 ` Maximilian Luz
2023-10-18 13:32 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).