diff options
| author | Alper Nebi Yasak <alpernebiyasak@gmail.com> | 2025-04-29 16:31:53 +0300 | 
|---|---|---|
| committer | Alper Nebi Yasak <alpernebiyasak@gmail.com> | 2025-04-29 16:37:14 +0300 | 
| commit | 35c853f8b33aea4d257a348e01a181a0a52e816f (patch) | |
| tree | 28ed1f02017914034718359ebdd41842eca1cdaa /config/seabios/default | |
| parent | 780844112ae8c8a4a9c3ef615f0220b8e25b0254 (diff) | |
seabios: Fix malloc_fn function pointer in romfile patch
One of our SeaBIOS patches causes build errors with GCC 15:
  src/romfile.c: In function 'romfile_loadfile_g':
  src/romfile.c:65:18: error: too many arguments to function 'malloc_fn'; expected 0, have 1
     65 |     char *data = malloc_fn(filesize+add_len);
        |                  ^~~~~~~~~ ~~~~~~~~~~~~~~~~
  src/romfile.c: In function 'romfile_loadfile':
  src/romfile.c:88:50: error: passing argument 3 of 'romfile_loadfile_g' from incompatible pointer type [-Wincompatible-pointer-types]
     88 |     char *data = romfile_loadfile_g(name, psize, &malloc_tmphigh, 1);
        |                                                  ^~~~~~~~~~~~~~~
        |                                                  |
        |                                                  void * (*)(u32) {aka void * (*)(unsigned int)}
  src/romfile.c:55:28: note: expected 'void * (*)(void)' but argument is of type 'void * (*)(u32)' {aka 'void * (*)(unsigned int)'}
     55 |                    void *(*malloc_fn)(), int add_len)
        |                    ~~~~~~~~^~~~~~~~~~~~
  In file included from src/romfile.c:8:
  src/malloc.h:42:21: note: 'malloc_tmphigh' declared here
     42 | static inline void *malloc_tmphigh(u32 size) {
        |                     ^~~~~~~~~~~~~~
  make: *** [Makefile:142: out/src/romfile.o] Error 1
  make: *** Waiting for unfinished jobs....
  src/optionroms.c: In function 'vgarom_setup':
  src/optionroms.c:468:60: error: passing argument 3 of 'romfile_loadfile_g' from incompatible pointer type [-Wincompatible-pointer-types]
    468 |     void *mxm_sis = romfile_loadfile_g("mxm-30-sis", NULL, &malloc_low, 0);
        |                                                            ^~~~~~~~~~~
        |                                                            |
        |                                                            void * (*)(u32) {aka void * (*)(unsigned int)}
  In file included from src/optionroms.c:18:
  src/romfile.h:17:34: note: expected 'void * (*)(void)' but argument is of type 'void * (*)(u32)' {aka 'void * (*)(unsigned int)'}
     17 |                          void *(*malloc_fn)(), int add_len);
        |                          ~~~~~~~~^~~~~~~~~~~~
  In file included from src/optionroms.c:16:
  src/malloc.h:30:21: note: 'malloc_low' declared here
     30 | static inline void *malloc_low(u32 size) {
        |                     ^~~~~~~~~~
  make: *** [Makefile:141: out/src/optionroms.o] Error 1
  make: Leaving directory '/tmp/lbmk/src/seabios/default'
This is because the function pointer defined as `void *(*malloc_fn)()`
refers to a function that takes no arguments, unlike `malloc_tmphigh`
which takes an unsigned int. Add the missing argument type.
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Diffstat (limited to 'config/seabios/default')
| -rw-r--r-- | config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch b/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch index f0682c11..2c042776 100644 --- a/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch +++ b/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch @@ -18,7 +18,7 @@ Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>   2 files changed, 22 insertions(+), 5 deletions(-)  diff --git a/src/romfile.c b/src/romfile.c -index b598274e..8bf95713 100644 +index b598274edc09..8ccf5139ece8 100644  --- a/src/romfile.c  +++ b/src/romfile.c  @@ -47,10 +47,12 @@ romfile_find(const char *name) @@ -33,7 +33,7 @@ index b598274e..8bf95713 100644   void *  -romfile_loadfile(const char *name, int *psize)  +romfile_loadfile_g(const char *name, int *psize, -+                   void *(*malloc_fn)(), int add_len) ++                   void *(*malloc_fn)(u32), int add_len)   {       struct romfile_s *file = romfile_find(name);       if (!file) @@ -69,7 +69,7 @@ index b598274e..8bf95713 100644   }  diff --git a/src/romfile.h b/src/romfile.h -index 3e0f8200..a320a5bc 100644 +index 3e0f820047dd..1b967d86551f 100644  --- a/src/romfile.h  +++ b/src/romfile.h  @@ -13,6 +13,8 @@ struct romfile_s { @@ -77,7 +77,7 @@ index 3e0f8200..a320a5bc 100644   struct romfile_s *romfile_findprefix(const char *prefix, struct romfile_s *prev);   struct romfile_s *romfile_find(const char *name);  +void *romfile_loadfile_g(const char *name, int *psize, -+                         void *(*malloc_fn)(), int add_len); ++                         void *(*malloc_fn)(u32), int add_len);   void *romfile_loadfile(const char *name, int *psize);   u64 romfile_loadint(const char *name, u64 defval);  | 
