Skip to content

Commit 2bb7632

Browse files
gagachangavpatel
authored andcommitted
lib: utils: Fix fdt_mpxy_init() not returning error code
It seems that current implementation doesn't fail on fdt_mpxy_init(), because platforms might not have any MPXY devices. In fact, if there are no MPXY devices, fdt_driver_init_all() will return SBI_OK. More importantly, if there is any MPXY device which fails the initialization, OpenSBI must check the error code and stop the booting. Thus, this commit adds the return value for fdt_mpxy_init(). Signed-off-by: Alvin Chang <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
1 parent f3cce5b commit 2bb7632

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

include/sbi_utils/mpxy/fdt_mpxy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
#ifdef CONFIG_FDT_MPXY
1717

18-
void fdt_mpxy_init(const void *fdt);
18+
int fdt_mpxy_init(const void *fdt);
1919

2020
#else
2121

22-
static inline void fdt_mpxy_init(const void *fdt) { }
22+
static inline int fdt_mpxy_init(const void *fdt) { return 0; }
2323

2424
#endif
2525

lib/utils/mpxy/fdt_mpxy.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
/* List of FDT MPXY drivers generated at compile time */
1313
extern const struct fdt_driver *const fdt_mpxy_drivers[];
1414

15-
void fdt_mpxy_init(const void *fdt)
15+
int fdt_mpxy_init(const void *fdt)
1616
{
17-
/*
18-
* Platforms might have multiple MPXY devices or might not
19-
* have any MPXY devices so don't fail.
20-
*/
21-
fdt_driver_init_all(fdt, fdt_mpxy_drivers);
17+
return fdt_driver_init_all(fdt, fdt_mpxy_drivers);
2218
}

platform/generic/platform.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,7 @@ int generic_mpxy_init(void)
324324
{
325325
const void *fdt = fdt_get_address();
326326

327-
fdt_mpxy_init(fdt);
328-
return 0;
327+
return fdt_mpxy_init(fdt);
329328
}
330329

331330
struct sbi_platform_operations generic_platform_ops = {

0 commit comments

Comments
 (0)