diff mbox series

[v2] platform/x86: samsung-galaxybook: Fix block_recording not supported logic

Message ID 20250303132433.348653-1-josh@joshuagrisham.com (mailing list archive)
State Accepted, archived
Headers show
Series [v2] platform/x86: samsung-galaxybook: Fix block_recording not supported logic | expand

Commit Message

Joshua Grisham March 3, 2025, 1:24 p.m. UTC
Fixes logic error when block_recording is not supported but the fw attr was
being added anyway (reported by GitHub user bbregeault).

Tested myself on a Samsung Galaxy Book2 Pro (has block_recording) and by
bbregeault on a Galaxy Book2 Business (does not have block_recording).

Fixes: 56f529ce4370 ("platform/x86: samsung-galaxybook: Add samsung-galaxybook driver")

Signed-off-by: Joshua Grisham <josh@joshuagrisham.com>

---
v1->v2:
- Add Fixes tag with prior commit (thanks Ilpo for catching!)
---
 drivers/platform/x86/samsung-galaxybook.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Armin Wolf March 5, 2025, 12:29 a.m. UTC | #1
Am 03.03.25 um 14:24 schrieb Joshua Grisham:

> Fixes logic error when block_recording is not supported but the fw attr was
> being added anyway (reported by GitHub user bbregeault).
>
> Tested myself on a Samsung Galaxy Book2 Pro (has block_recording) and by
> bbregeault on a Galaxy Book2 Business (does not have block_recording).

For the future you can use Tested-by tags to indicate who tested this patch.
For now:

Reviewed-by: Armin Wolf <W_Armin@gmx.de>

> Fixes: 56f529ce4370 ("platform/x86: samsung-galaxybook: Add samsung-galaxybook driver")
>
> Signed-off-by: Joshua Grisham <josh@joshuagrisham.com>
>
> ---
> v1->v2:
> - Add Fixes tag with prior commit (thanks Ilpo for catching!)
> ---
>   drivers/platform/x86/samsung-galaxybook.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
> index de1ed2dc6..5878a3519 100644
> --- a/drivers/platform/x86/samsung-galaxybook.c
> +++ b/drivers/platform/x86/samsung-galaxybook.c
> @@ -1100,11 +1100,13 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
>   	}
>
>   	err = galaxybook_block_recording_init(galaxybook);
> -	if (!err)
> -		galaxybook->has_block_recording = true;
> -	else if (err != GB_NOT_SUPPORTED)
> +	if (err == GB_NOT_SUPPORTED)
> +		return 0;
> +	else if (err)
>   		return err;
>
> +	galaxybook->has_block_recording = true;
> +
>   	return galaxybook_fw_attr_init(galaxybook,
>   				       GB_ATTR_BLOCK_RECORDING,
>   				       &block_recording_acpi_get,
Ilpo Järvinen March 5, 2025, 1:09 p.m. UTC | #2
On Mon, 03 Mar 2025 14:24:32 +0100, Joshua Grisham wrote:

> Fixes logic error when block_recording is not supported but the fw attr was
> being added anyway (reported by GitHub user bbregeault).
> 
> Tested myself on a Samsung Galaxy Book2 Pro (has block_recording) and by
> bbregeault on a Galaxy Book2 Business (does not have block_recording).
> 
> Fixes: 56f529ce4370 ("platform/x86: samsung-galaxybook: Add samsung-galaxybook driver")
> 
> [...]


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.

The list of commits applied:
[1/1] platform/x86: samsung-galaxybook: Fix block_recording not supported logic
      commit: 7bb84ca9b8d0cfff76a6108636aec1a5a8cdcd49

--
 i.
diff mbox series

Patch

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index de1ed2dc6..5878a3519 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -1100,11 +1100,13 @@  static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
 	}
 
 	err = galaxybook_block_recording_init(galaxybook);
-	if (!err)
-		galaxybook->has_block_recording = true;
-	else if (err != GB_NOT_SUPPORTED)
+	if (err == GB_NOT_SUPPORTED)
+		return 0;
+	else if (err)
 		return err;
 
+	galaxybook->has_block_recording = true;
+
 	return galaxybook_fw_attr_init(galaxybook,
 				       GB_ATTR_BLOCK_RECORDING,
 				       &block_recording_acpi_get,