From nobody Sat Apr 4 03:27:36 2026 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 819333D88E3 for ; Fri, 20 Mar 2026 23:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774050983; cv=none; b=l4XhD3sCVOzb2YhqQLvV+thcyGk9LuLExvq4HsreUYAUu9Qift/CahHu8XacOKTCpLP94nL9CuD+ECNG313p3CrweaUJBjGcNRqjywknT9+iN21FRYnInEz3mE9oteKtnq6V8MGYDbDvRYiWq1eba2CIqx2Q6sH52LH0SggFmTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774050983; c=relaxed/simple; bh=a65n9qrxIlLmhNIbEN4ovVg4f46IUX7I1DiASQ8NWOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J51pbc6SCwqsjGeRmHgfF8hJeBWUBLfpFEdo2tXtb3kAttoiHRjvCn0/HDcyVm+O11eltw/kt5OQQPqTCI4cxeux8qPyko26/feCJn02k6bgfzeeTVBWmU0/hrk8EC9kERmqpFMkiBdvCJdCPsN8yZZhbped9tDfsH9UilpxhR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mM4ZjzFS; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mM4ZjzFS" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-439b83ed536so146345f8f.0 for ; Fri, 20 Mar 2026 16:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774050967; x=1774655767; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P9+vTI8xL38TJIAAcKMuD2MJ4WOoS3U7UcRhiuvjKaM=; b=mM4ZjzFS5MA8vPT1ZcrWfeRqQKK+vbWd/VTn2dkGdGlL0LDaGc0Qf1dZyzwyNObyB5 VoxaJIB3//MhQwdd5ouacVZBbMJJz13iwNKvvEnV5f/aCrQ4a2p65v3fgya/iXE59TNP nhvV2yf9D+5NtXapvKXIpM+0wHaG4zYHl7t4giWsYmqF+p+KiOdpOeHhIKFJqtfJorNX 0s/7nRuMMgp3beR/zH1WcZMtZYitoqi8mFph6dgcUV7MwIyBZYtEw8pfBkp2KPII1e+U T5A11z0WaF4ahwFXwds7o40OXHpOC+eU3atIfmfGNiv6lJjz24oCd2gEG6vBXMAxpe13 jHsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774050967; x=1774655767; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=P9+vTI8xL38TJIAAcKMuD2MJ4WOoS3U7UcRhiuvjKaM=; b=HKrTRgnNr5yg0D7sfY/B/mNlRPnKiI9q6BcINar34s7BoEWuOQTsIlH0UFFC3pt4Zt ZZlo/P6TNwSEySlPeifhLse/CrjrabvfqvepKt3GP50ZPLHxOlg1h/MHuE32BHRlU+nO 99gRsw+JZfwwoDJganggX0DTESUvAUElIJtNB0mdN3Pw+VR65y7yzWgpzCSasAN3dHQl Q++5qI/6FlC+wGykYtpsj0KlPwgyfFr7b93IUHYO2tGLQmvwpxF5qZ7cdrBIKAATVj44 F9vEn7jfUfpIEzmiXyjIZa5iT3RO19El3Zb/CaJu3IA6TXMzXlJ+iOuhKcoFu4L2uSZj jhKg== X-Forwarded-Encrypted: i=1; AJvYcCX7HUWV3wmTOjzhzkKoCI0x3SbOheoHUlEQAZzm+UYYBt/g8pbrOUJzmt2Lc5VLkMb96uPnGMs102NvWuI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3c7FxH6BP/qFxo2TI+RT9yO3lro+G99J/7aCEl8IVr6DFynK7 YfL4+3Qh8pAxGtjtoYHlIg4o6N4kROFo+G8Z3bWqC9yyJIxCT4q5Vvff X-Gm-Gg: ATEYQzyVlEbpXt+5+Zz53JZwgWYaEjMxzNLKK14dn/JyHEUBgA+zJDxXVCd3JGvvxzA ey8t3yiizd1zqcbc1Zdt2fxbIkgPWQpYUqKWQAtIXUk0H4gSWb26vj3wYgdSIHIcLbI/ca5vxlb UC9ZG/AO5jesnCA+bvBsOobJhYNOouiryi+yD/R8IslJIsyO+M+3F7jAPntKrfRS6s+JybLz1dO xJqKnMuALRTkfBlyw+f7HRBzjA6uXgt7mzmxpcsd+24fi0NBM6wIV/eaFoS2Aad3nZPWt5BW9VQ /mB1Ca+7lGzXWK8XwRX5dfqsQ90kTpbmGwOAXr06sWsNPiWqE/CVPIh14C97uh5g5M8RfnneuMa jaBusTSYiORA72MzMf+IS/PqT1BPE2lWIjiuKJTazZCWfAInLGxhDA0ByG+VxzyLsTome34T4e7 qsjFD47TTU374ykEg72qn+cTvI/29HRrwcmHww4AjonZdofiS17TPZsmTL X-Received: by 2002:a05:6000:43c5:10b0:43b:433f:4898 with SMTP id ffacd0b85a97d-43b642331fbmr3187205f8f.1.1774050967301; Fri, 20 Mar 2026 16:56:07 -0700 (PDT) Received: from fridge ([195.174.58.89]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b6470c239sm9663418f8f.27.2026.03.20.16.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 16:56:06 -0700 (PDT) From: Emre Cecanpunar To: platform-driver-x86@vger.kernel.org Cc: hansg@kernel.org, ilpo.jarvinen@linux.intel.com, krishna.chomal108@gmail.com, linux-kernel@vger.kernel.org, Emre Cecanpunar Subject: [PATCH 1/5] platform/x86: hp-wmi: fix ignored return values in fan settings Date: Sat, 21 Mar 2026 02:55:53 +0300 Message-ID: <20260320235557.56298-2-emreleno@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260320235557.56298-1-emreleno@gmail.com> References: <20260320235557.56298-1-emreleno@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" hp_wmi_get_fan_count_userdefine_trigger() can fail, but its return value was silently discarded in the PWM_MODE_MAX and PWM_MODE_AUTO cases of hp_wmi_apply_fan_settings(). The same function's return value is already checked in hp_wmi_fan_speed_set(). Propagate errors consistently. hp_wmi_apply_fan_settings() itself returned an error code in all paths, but its callers hp_wmi_hwmon_keep_alive_handler() and hp_wmi_hwmon_init() both discarded the return value. Log failures via pr_warn_ratelimited() in the keep-alive handler (rate-limited because it fires every 90 seconds) and dev_warn() in init (non-fatal: the hwmon device is already registered). Also remove the unreachable "return 0" after the switch statement in hp_wmi_apply_fan_settings(): every case branch already returns explicitly. Signed-off-by: Emre Cecanpunar --- drivers/platform/x86/hp/hp-wmi.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-= wmi.c index 68ede7e5757a..0cb2a2b31998 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -2334,8 +2334,11 @@ static int hp_wmi_apply_fan_settings(struct hp_wmi_h= wmon_priv *priv) =20 switch (priv->mode) { case PWM_MODE_MAX: - if (is_victus_s_thermal_profile()) - hp_wmi_get_fan_count_userdefine_trigger(); + if (is_victus_s_thermal_profile()) { + ret =3D hp_wmi_get_fan_count_userdefine_trigger(); + if (ret < 0) + return ret; + } ret =3D hp_wmi_fan_speed_max_set(1); if (ret < 0) return ret; @@ -2353,7 +2356,9 @@ static int hp_wmi_apply_fan_settings(struct hp_wmi_hw= mon_priv *priv) return 0; case PWM_MODE_AUTO: if (is_victus_s_thermal_profile()) { - hp_wmi_get_fan_count_userdefine_trigger(); + ret =3D hp_wmi_get_fan_count_userdefine_trigger(); + if (ret < 0) + return ret; ret =3D hp_wmi_fan_speed_max_reset(priv); } else { ret =3D hp_wmi_fan_speed_max_set(0); @@ -2366,8 +2371,6 @@ static int hp_wmi_apply_fan_settings(struct hp_wmi_hw= mon_priv *priv) /* shouldn't happen */ return -EINVAL; } - - return 0; } =20 static umode_t hp_wmi_hwmon_is_visible(const void *data, @@ -2509,6 +2512,7 @@ static void hp_wmi_hwmon_keep_alive_handler(struct wo= rk_struct *work) { struct delayed_work *dwork; struct hp_wmi_hwmon_priv *priv; + int ret; =20 dwork =3D to_delayed_work(work); priv =3D container_of(dwork, struct hp_wmi_hwmon_priv, keep_alive_dwork); @@ -2516,7 +2520,10 @@ static void hp_wmi_hwmon_keep_alive_handler(struct w= ork_struct *work) * Re-apply the current hwmon context settings. * NOTE: hp_wmi_apply_fan_settings will handle the re-scheduling. */ - hp_wmi_apply_fan_settings(priv); + ret =3D hp_wmi_apply_fan_settings(priv); + if (ret) + pr_warn_ratelimited("keep-alive failed to refresh fan settings: %d\n", + ret); } =20 static int hp_wmi_setup_fan_settings(struct hp_wmi_hwmon_priv *priv) @@ -2578,7 +2585,9 @@ static int hp_wmi_hwmon_init(void) =20 INIT_DELAYED_WORK(&priv->keep_alive_dwork, hp_wmi_hwmon_keep_alive_handle= r); platform_set_drvdata(hp_wmi_platform_dev, priv); - hp_wmi_apply_fan_settings(priv); + ret =3D hp_wmi_apply_fan_settings(priv); + if (ret) + dev_warn(dev, "Failed to apply initial fan settings: %d\n", ret); =20 return 0; } --=20 2.53.0