]> git.ipfire.org Git - thirdparty/u-boot.git/commit
string: fix prototype of memdup()
authorRasmus Villemoes <ravi@prevas.dk>
Tue, 21 Apr 2026 07:54:31 +0000 (09:54 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 12 May 2026 21:38:00 +0000 (15:38 -0600)
commitca1c292d2ee6bcb06be71400d25ae37e9dc2c1aa
tree23832b238f7c65f9d8de787e8b7afcef9c6417a8
parentbbc04206b5cb358e1482d06c74f2801c9ef97751
string: fix prototype of memdup()

It doesn't make sense to restrict memdup() to only return char*
pointers, especially when it is already defined to accept void*. This
makes it uglier to use to e.g. duplicate a struct.

Make it return void*, just as kmemdup() does in the kernel (and which
our kmemdup() in fact also does).

While in here, make a small optimization: memcpy() is defined to
return the destination register, so we write this in a way that the
compiler may do a tail call.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
include/linux/string.h
lib/string.c