powerpc/pseries: Handle and log pseries-wdt registration failures

The pseries watchdog initialization registers the pseries-wdt platform
device using platform_device_register_simple(), but currently ignores
its return value.

Check the returned pointer for errors, log a descriptive error message
when registration fails, and propagate the failure code to the caller.
This avoids silently ignoring platform device registration failures.

Cc: stable@vger.kernel.org
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260727053416.276317-3-sourabhjain@linux.ibm.com
This commit is contained in:
Sourabh Jain
2026-07-27 11:04:15 +05:30
committed by Madhavan Srinivasan
parent 516a254918
commit e65b526aff

View File

@@ -191,8 +191,18 @@ static void __init fwnmi_init(void)
*/
static __init int pseries_wdt_init(void)
{
if (firmware_has_feature(FW_FEATURE_WATCHDOG))
platform_device_register_simple("pseries-wdt", 0, NULL, 0);
struct platform_device *pdev;
if (!firmware_has_feature(FW_FEATURE_WATCHDOG))
return 0;
pdev = platform_device_register_simple("pseries-wdt", 0, NULL, 0);
if (IS_ERR(pdev)) {
pr_err("Failed to register pseries-wdt platform device\n");
return PTR_ERR(pdev);
}
return 0;
}
machine_subsys_initcall(pseries, pseries_wdt_init);