public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] sandbox: fix the return type of os_free() function
@ 2014-01-15  4:06 Masahiro Yamada
  2014-01-27 14:56 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2014-01-15  4:06 UTC (permalink / raw)
  To: u-boot

The function os_free() returns nothing.
Its return type should be "void" rather than "void *".

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Simon,

This commit fixes a warning:

u-boot/include/os.h: In function ?os_free?:
arch/sandbox/cpu/os.c:153:1: warning: control reaches end of non-void function [-Wreturn-type]

But, this warning message is not displayed on the current u-boot/master
because commit cbe5cdfcd3 changed arch/sandbox/cpu/Makefile badly.

The build rule in arch/sandbox/cpu/Makefile

  $(obj)os.o: ALL_CFLAGS := $(BASE_CPPFLAGS) \
        $(patsubst %, -idirafter %, $(BASE_INCLUDE_DIRS))

drops many flags including "-Wall".

That's why you did not notice such a mistake,
which the build system should have detected.

This problem can be fixed in my patch
http://patchwork.ozlabs.org/patch/294233/
(It is also a prerequisite for my Kbuild series.)


 arch/sandbox/cpu/os.c | 2 +-
 include/os.h          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 725b505..2e2fc58 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -143,7 +143,7 @@ void *os_malloc(size_t length)
 	return hdr + 1;
 }
 
-void *os_free(void *ptr)
+void os_free(void *ptr)
 {
 	struct os_mem_hdr *hdr = ptr;
 
diff --git a/include/os.h b/include/os.h
index b65fba4..d6d6e57 100644
--- a/include/os.h
+++ b/include/os.h
@@ -113,7 +113,7 @@ void *os_malloc(size_t length);
  *
  * \param ptr		Pointer to memory block to free
  */
-void *os_free(void *ptr);
+void os_free(void *ptr);
 
 /**
  * Reallocate previously-allocated memory to increase/decrease space
-- 
1.8.3.2

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

* [U-Boot] sandbox: fix the return type of os_free() function
  2014-01-15  4:06 [U-Boot] [PATCH] sandbox: fix the return type of os_free() function Masahiro Yamada
@ 2014-01-27 14:56 ` Tom Rini
  2014-01-27 16:22   ` Simon Glass
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2014-01-27 14:56 UTC (permalink / raw)
  To: u-boot

On Wed, Jan 15, 2014 at 01:06:41PM +0900, Masahiro Yamada wrote:

> The function os_free() returns nothing.
> Its return type should be "void" rather than "void *".
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140127/62acec93/attachment.pgp>

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

* [U-Boot] sandbox: fix the return type of os_free() function
  2014-01-27 14:56 ` [U-Boot] " Tom Rini
@ 2014-01-27 16:22   ` Simon Glass
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Glass @ 2014-01-27 16:22 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On 27 January 2014 07:56, Tom Rini <trini@ti.com> wrote:
> On Wed, Jan 15, 2014 at 01:06:41PM +0900, Masahiro Yamada wrote:
>
>> The function os_free() returns nothing.
>> Its return type should be "void" rather than "void *".
>>
>> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
>
> Applied to u-boot/master, thanks!

I was preparing a small pull request with this and another patch but
you beat me to it!

Can you please also look at this one:

http://patchwork.ozlabs.org/patch/294233/

I am still running a full build (since I did it incorrectly yesterday)
but it looks good.

Regards,
Simon

>
> --
> Tom

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

end of thread, other threads:[~2014-01-27 16:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15  4:06 [U-Boot] [PATCH] sandbox: fix the return type of os_free() function Masahiro Yamada
2014-01-27 14:56 ` [U-Boot] " Tom Rini
2014-01-27 16:22   ` Simon Glass

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