diff options
author | Luke D. Jones <luke@ljones.dev> | 2023-08-30 05:29:08 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-08-30 16:25:18 +0300 |
commit | acce85a7dd28eac3858d44230f4c65985d0f271c (patch) | |
tree | 83095d20cb025c7b191640922ed1e368c5ade53a /drivers/platform | |
parent | 06469a8dc37598176937dac1f6ca41e8f0db2b81 (diff) | |
download | linux-acce85a7dd28eac3858d44230f4c65985d0f271c.tar.xz |
platform/x86: asus-wmi: corrections to egpu safety check
An incorrect if statement was preventing the enablement of the egpu.
Fixes: d49f4d1a30ac ("platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected")
Signed-off-by: Luke D. Jones <luke@ljones.dev>
Link: https://lore.kernel.org/r/20230830022908.36264-2-luke@ljones.dev
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 9783893d2d6e..9f8cea5f9615 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -726,19 +726,18 @@ static ssize_t egpu_enable_store(struct device *dev, return -EINVAL; err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED); - if (err < 0) - return err; - if (err < 1) { - err = -ENODEV; - pr_warn("Failed to set egpu disable: %d\n", err); + if (err < 0) { + pr_warn("Failed to get egpu connection status: %d\n", err); return err; } if (asus->gpu_mux_mode_available) { result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); - if (result < 0) + if (result < 0) { /* An error here may signal greater failure of GPU handling */ + pr_warn("Failed to get gpu mux status: %d\n", result); return result; + } if (!result && enable) { err = -ENODEV; pr_warn("Can not enable eGPU when the MUX is in dGPU mode: %d\n", err); @@ -748,12 +747,12 @@ static ssize_t egpu_enable_store(struct device *dev, err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result); if (err) { - pr_warn("Failed to set egpu disable: %d\n", err); + pr_warn("Failed to set egpu state: %d\n", err); return err; } if (result > 1) { - pr_warn("Failed to set egpu disable (retval): 0x%x\n", result); + pr_warn("Failed to set egpu state (retval): 0x%x\n", result); return -EIO; } |