mirror of
https://github.com/torvalds/linux.git
synced 2024-12-09 20:51:43 +00:00
1b5e6f4ec0
Patch series "mips: address -Wmissing-prototypes warnings". Address the -Wmissing-prototypes warnings that showed up in mips as the last major architecture after my patch to enable the option everywhere. This patch (of 20): The mips decompressor has some string functions defined locally that are not declared in the right place: arch/mips/boot/compressed/dbg.c:12:13: error: no previous prototype for 'putc' [-Werror=missing-prototypes] arch/mips/boot/compressed/dbg.c:16:6: error: no previous prototype for 'puts' [-Werror=missing-prototypes] arch/mips/boot/compressed/dbg.c:26:6: error: no previous prototype for 'puthex' [-Werror=missing-prototypes] arch/mips/boot/compressed/string.c:11:7: error: no previous prototype for 'memcpy' [-Werror=missing-prototypes] arch/mips/boot/compressed/string.c:22:7: error: no previous prototype for 'memset' [-Werror=missing-prototypes] arch/mips/boot/compressed/string.c:32:15: error: no previous prototype for 'memmove' [-Werror=missing-prototypes] arch/mips/boot/compressed/decompress.c:43:6: error: no previous prototype for 'error' [-Werror=missing-prototypes] arch/mips/boot/compressed/decompress.c:91:6: error: no previous prototype for 'decompress_kernel' [-Werror=missing-prototypes] Include the string.h header where needed and add a decompress.h header to have shared prototypes for the rest. Link: https://lkml.kernel.org/r/20231204115710.2247097-1-arnd@kernel.org Link: https://lkml.kernel.org/r/20231204115710.2247097-2-arnd@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Stephen Rothwell <sfr@rothwell.id.au> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
48 lines
779 B
C
48 lines
779 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* arch/mips/boot/compressed/string.c
|
|
*
|
|
* Very small subset of simple string routines
|
|
*/
|
|
|
|
#include <linux/compiler_attributes.h>
|
|
#include <linux/types.h>
|
|
#include <asm/string.h>
|
|
|
|
void *memcpy(void *dest, const void *src, size_t n)
|
|
{
|
|
int i;
|
|
const char *s = src;
|
|
char *d = dest;
|
|
|
|
for (i = 0; i < n; i++)
|
|
d[i] = s[i];
|
|
return dest;
|
|
}
|
|
|
|
void *memset(void *s, int c, size_t n)
|
|
{
|
|
int i;
|
|
char *ss = s;
|
|
|
|
for (i = 0; i < n; i++)
|
|
ss[i] = c;
|
|
return s;
|
|
}
|
|
|
|
void * __weak memmove(void *dest, const void *src, size_t n)
|
|
{
|
|
unsigned int i;
|
|
const char *s = src;
|
|
char *d = dest;
|
|
|
|
if ((uintptr_t)dest < (uintptr_t)src) {
|
|
for (i = 0; i < n; i++)
|
|
d[i] = s[i];
|
|
} else {
|
|
for (i = n; i > 0; i--)
|
|
d[i - 1] = s[i - 1];
|
|
}
|
|
return dest;
|
|
}
|