⬢ DragonFlyBSD Kernel Audit
DF-5181 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/powerplay/smumgr/smu9_smumgr.c
+++ b/sys/dev/drm/amd/powerplay/smumgr/smu9_smumgr.c
@@ -113,7 +113,10 @@
 	if (ret != 1)
 		pr_err("Failed to send message: 0x%x, ret value: 0x%x\n", msg, ret);
 
-	return 0;
+	/* 0 == success; non-zero propagates SMC failure to callers, which
+	 * already test the return value (vega10_smumgr.c:147,
+	 * vega12_smumgr.c:52-57 expect 0 == success). */
+	return (ret == 1) ? 0 : -EIO;
 }
 
 /*
@@ -143,7 +146,8 @@
 	if (ret != 1)
 		pr_err("Failed message: 0x%x, input parameter: 0x%x, error code: 0x%x\n", msg, parameter, ret);
 
-	return 0;
+	/* 0 == success; non-zero propagates SMC failure to callers. */
+	return (ret == 1) ? 0 : -EIO;
 }
 
 uint32_t smu9_get_argument(struct pp_hwmgr *hwmgr);