mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] mfd: ls2kbmc: Fix stop_machine() function's retvals
@ 2026-10-07 23:56 Borislav Petkov (AMD)
  2026-10-15 15:57 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Borislav Petkov (AMD) @ 2026-10-07 23:56 UTC (permalink / raw)
  To: Binbin Zhou, Chong Qiao; +Cc: Lee Jones, mfd, LKML

Hi,

see below.

It is totally untested because I don't have the hardware but the issue should
be clear.

Maybe the retvals should be tweaked, to denote even better what fails in
the function when it happens.

Thx.

---
stop_machine() takes a function to run @fn of type cpu_stop_fn_t as its
first parameter, which returns an int. That int is either 0 on a success
or non-zero on failure.

The ls2k_bmc_recover_pci_data() function returns "false" instead to
denote a failure, presumably, which gets promoted to a 0.

Add proper negative return values to denote the different failures
encountered.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
 drivers/mfd/ls2k-bmc-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/ls2k-bmc-core.c b/drivers/mfd/ls2k-bmc-core.c
index 408056bfb2fe..306e444a592a 100644
--- a/drivers/mfd/ls2k-bmc-core.c
+++ b/drivers/mfd/ls2k-bmc-core.c
@@ -268,18 +268,18 @@ static int ls2k_bmc_recover_pci_data(void *data)
 	}
 
 	if (i == 0)
-		return false;
+		return -ETIMEDOUT;
 
 	ls2k_bmc_restore_bridge_pci_data(parent, ddata);
 
 	/* Check if PCI-E is connected */
 	if (!ls2k_bmc_pcie_is_connected(parent, ddata))
-		return false;
+		return -EINVAL;
 
 	/* Waiting for U-Boot and DDR ready */
 	mdelay(LS2K_BMC_RESET_WAIT_TIME);
 	if (!ls2k_bmc_bar0_addr_is_set(parent))
-		return false;
+		return -EINVAL;
 
 	/* Restore LS2K BMC PCI-E config data */
 	pci_write_config_dword(pdev, PCI_COMMAND, ddata->bmc_pci_data.pci_command);
-- 
2.53.0

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-15 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-07 23:56 [RFC PATCH] mfd: ls2kbmc: Fix stop_machine() function's retvals Borislav Petkov (AMD)
2026-10-15 15:57 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®