Patch "platform/x86: thinkpad_acpi: Only update profile if successfully converted" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    platform/x86: thinkpad_acpi: Only update profile if successfully converted

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     platform-x86-thinkpad_acpi-only-update-profile-if-su.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8fc26909a964f077003d7edfb79b9ccaf8542d96
Author: Mario Limonciello <mario.limonciello@xxxxxxx>
Date:   Fri Feb 16 20:23:11 2024 -0600

    platform/x86: thinkpad_acpi: Only update profile if successfully converted
    
    [ Upstream commit 427c70dec738318b7f71e1b9d829ff0e9771d493 ]
    
    Randomly a Lenovo Z13 will trigger a kernel warning traceback from this
    condition:
    
    ```
    if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names))))
    ```
    
    This happens because thinkpad-acpi always assumes that
    convert_dytc_to_profile() successfully updated the profile. On the
    contrary a condition can occur that when dytc_profile_refresh() is called
    the profile doesn't get updated as there is a -EOPNOTSUPP branch.
    
    Catch this situation and avoid updating the profile. Also log this into
    dynamic debugging in case any other modes should be added in the future.
    
    Fixes: c3bfcd4c6762 ("platform/x86: thinkpad_acpi: Add platform profile support")
    Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
    Link: https://lore.kernel.org/r/20240217022311.113879-1-mario.limonciello@xxxxxxx
    Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index d73cbae4aa218..89c37a83d7fcd 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -10308,6 +10308,7 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode,
 		return 0;
 	default:
 		/* Unknown function */
+		pr_debug("unknown function 0x%x\n", funcmode);
 		return -EOPNOTSUPP;
 	}
 	return 0;
@@ -10493,8 +10494,8 @@ static void dytc_profile_refresh(void)
 		return;
 
 	perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF;
-	convert_dytc_to_profile(funcmode, perfmode, &profile);
-	if (profile != dytc_current_profile) {
+	err = convert_dytc_to_profile(funcmode, perfmode, &profile);
+	if (!err && profile != dytc_current_profile) {
 		dytc_current_profile = profile;
 		platform_profile_notify();
 	}




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux