diff options
author | Tom Rini <trini@konsulko.com> | 2023-03-22 20:57:39 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-03-22 20:57:39 -0400 |
commit | 884d626d8357853c012d535bf26c143bb7b5e6a5 (patch) | |
tree | 06ac245b48b6cc59b392b5117030dffd63459db1 | |
parent | 12340b122b354ecca350c0d08ac3d825897bdafa (diff) | |
parent | 486930bd7fe1db63c302c960445cdd4be4a4f1d1 (diff) | |
download | u-boot-884d626d8357853c012d535bf26c143bb7b5e6a5.zip u-boot-884d626d8357853c012d535bf26c143bb7b5e6a5.tar.gz u-boot-884d626d8357853c012d535bf26c143bb7b5e6a5.tar.bz2 |
Merge branch '2023-03-22-assorted-minor-code-cleanups' into next
- Minor code cleanups based on problems found by clang or enabling LTO.
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-hpe/gxp/reset.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/image-container.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-mediatek/mt7981/init.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-mediatek/mt7986/init.c | 3 | ||||
-rw-r--r-- | board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 3 | ||||
-rw-r--r-- | board/armltd/corstone1000/corstone1000.c | 3 | ||||
-rw-r--r-- | board/bosch/acc/acc.c | 3 | ||||
-rw-r--r-- | board/purism/librem5/spl.c | 3 | ||||
-rw-r--r-- | common/dlmalloc.c | 8 | ||||
-rw-r--r-- | examples/standalone/Makefile | 4 | ||||
-rw-r--r-- | include/spl.h | 13 | ||||
-rw-r--r-- | lib/libavb/avb_cmdline.c | 2 | ||||
-rw-r--r-- | lib/zlib/trees.c | 2 | ||||
-rw-r--r-- | tools/imx8image.c | 5 | ||||
-rw-r--r-- | tools/proftool.c | 15 |
16 files changed, 40 insertions, 32 deletions
@@ -790,6 +790,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) # See modpost pattern 2 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) +KBUILD_CFLAGS += $(call cc-disable-warning, deprecated-non-prototype) endif # These warnings generated too much noise in a regular build. diff --git a/arch/arm/mach-hpe/gxp/reset.c b/arch/arm/mach-hpe/gxp/reset.c index ce018a3..a147bca 100644 --- a/arch/arm/mach-hpe/gxp/reset.c +++ b/arch/arm/mach-hpe/gxp/reset.c @@ -7,6 +7,7 @@ * Author: Jean-Marie Verdun <verdun@hpe.com> */ +#include <cpu_func.h> #include <asm/io.h> #define GXP_CCR 0xc0000000 @@ -16,7 +17,7 @@ void lowlevel_init(void) { } -void reset_cpu(ulong ignored) +void reset_cpu(void) { writel(1, GXP_CCR); diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c index 06ee608..5b059a6 100644 --- a/arch/arm/mach-imx/image-container.c +++ b/arch/arm/mach-imx/image-container.c @@ -10,6 +10,7 @@ #include <asm/io.h> #include <mmc.h> #include <spi_flash.h> +#include <spl.h> #include <nand.h> #include <asm/mach-imx/image.h> #include <asm/arch/sys_proto.h> diff --git a/arch/arm/mach-mediatek/mt7981/init.c b/arch/arm/mach-mediatek/mt7981/init.c index d8b10f0..3c921d6 100644 --- a/arch/arm/mach-mediatek/mt7981/init.c +++ b/arch/arm/mach-mediatek/mt7981/init.c @@ -4,6 +4,7 @@ * Author: Sam Shih <sam.shih@mediatek.com> */ +#include <cpu_func.h> #include <init.h> #include <asm/armv8/mmu.h> #include <asm/system.h> @@ -19,7 +20,7 @@ int dram_init(void) return 0; } -void reset_cpu(ulong addr) +void reset_cpu(void) { psci_system_reset(); } diff --git a/arch/arm/mach-mediatek/mt7986/init.c b/arch/arm/mach-mediatek/mt7986/init.c index fb74b2f..9d0c0cd 100644 --- a/arch/arm/mach-mediatek/mt7986/init.c +++ b/arch/arm/mach-mediatek/mt7986/init.c @@ -4,6 +4,7 @@ * Author: Sam Shih <sam.shih@mediatek.com> */ +#include <cpu_func.h> #include <init.h> #include <asm/armv8/mmu.h> #include <asm/system.h> @@ -19,7 +20,7 @@ int dram_init(void) return 0; } -void reset_cpu(ulong addr) +void reset_cpu(void) { psci_system_reset(); } diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c index 34109c6..09e63e0 100644 --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c @@ -208,7 +208,8 @@ int board_late_init(void) #ifdef CONFIG_SPL_MMC #define UBOOT_RAW_SECTOR_OFFSET 0x40 -unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc) +unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, + unsigned long raw_sector) { u32 boot_dev = spl_boot_device(); diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c index 4f4b96a..6ec8e61 100644 --- a/board/armltd/corstone1000/corstone1000.c +++ b/board/armltd/corstone1000/corstone1000.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <cpu_func.h> #include <dm.h> #include <netdev.h> #include <dm/platform_data/serial_pl01x.h> @@ -86,6 +87,6 @@ int dram_init_banksize(void) return 0; } -void reset_cpu(ulong addr) +void reset_cpu(void) { } diff --git a/board/bosch/acc/acc.c b/board/bosch/acc/acc.c index 770ca8b..4a0603d 100644 --- a/board/bosch/acc/acc.c +++ b/board/bosch/acc/acc.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <cpu_func.h> #include <bootstage.h> #include <dm.h> #include <dm/platform_data/serial_mxc.h> @@ -720,7 +721,7 @@ int board_fit_config_name_match(const char *name) return -1; } -void reset_cpu(ulong addr) +void reset_cpu(void) { puts("Hanging CPU for watchdog reset!\n"); hang(); diff --git a/board/purism/librem5/spl.c b/board/purism/librem5/spl.c index 1a203b4..90f1fcf 100644 --- a/board/purism/librem5/spl.c +++ b/board/purism/librem5/spl.c @@ -26,6 +26,7 @@ #include <usb.h> #include <dwc3-uboot.h> #include <linux/delay.h> +#include <linux/usb/gadget.h> #include "librem5.h" DECLARE_GLOBAL_DATA_PTR; @@ -417,7 +418,7 @@ out: return rv; } -int usb_gadget_handle_interrupts(void) +int usb_gadget_handle_interrupts(int index) { dwc3_uboot_handle_interrupt(0); return 0; diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 41c7230..0f9b726 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -80,7 +80,7 @@ GmListElement* makeGmListElement (void* bas) return this; } -void gcleanup () +void gcleanup (void) { BOOL rval; assert ( (head == NULL) || (head->base == (void*)gAddressBase)); @@ -2340,7 +2340,7 @@ size_t malloc_usable_size(mem) Void_t* mem; /* Utility to update current_mallinfo for malloc_stats and mallinfo() */ #ifdef DEBUG -static void malloc_update_mallinfo() +static void malloc_update_mallinfo(void) { int i; mbinptr b; @@ -2397,7 +2397,7 @@ static void malloc_update_mallinfo() */ #ifdef DEBUG -void malloc_stats() +void malloc_stats(void) { malloc_update_mallinfo(); printf("max system bytes = %10u\n", @@ -2418,7 +2418,7 @@ void malloc_stats() */ #ifdef DEBUG -struct mallinfo mALLINFo() +struct mallinfo mALLINFo(void) { malloc_update_mallinfo(); return current_mallinfo; diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5b48a9d..559170d 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -29,6 +29,10 @@ targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBOBJS-y) LIBOBJS := $(addprefix $(obj)/,$(LIBOBJS-y)) ELF := $(addprefix $(obj)/,$(ELF)) +# Disable LTO for these builds +CFLAGS_REMOVE_hello_world.o := $(LTO_CFLAGS) +CFLAGS_REMOVE_stubs.o := $(LTO_CFLAGS) + # For PowerPC there's no need to compile standalone applications as a # relocatable executable. The relocation data is not needed, and # also causes the entry point of the standalone application to be diff --git a/include/spl.h b/include/spl.h index bad12fb..7e0f5ac 100644 --- a/include/spl.h +++ b/include/spl.h @@ -467,6 +467,19 @@ int spl_mmc_emmc_boot_partition(struct mmc *mmc); void spl_set_bd(void); /** + * spl_mmc_get_uboot_raw_sector() - Provide raw sector of the start of U-Boot + * + * This is a weak function which by default will provide the raw sector that is + * where the start of the U-Boot image has been written to. + * + * @mmc: struct mmc that describes the devie where U-Boot resides + * @raw_sect: The raw sector number where U-Boot is by default. + * Return: The raw sector location that U-Boot resides at + */ +unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, + unsigned long raw_sect); + +/** * spl_set_header_raw_uboot() - Set up a standard SPL image structure * * This sets up the given spl_image which the standard values obtained from diff --git a/lib/libavb/avb_cmdline.c b/lib/libavb/avb_cmdline.c index cb54e65..a58ce6c 100644 --- a/lib/libavb/avb_cmdline.c +++ b/lib/libavb/avb_cmdline.c @@ -394,7 +394,7 @@ out: return ret; } -AvbCmdlineSubstList* avb_new_cmdline_subst_list() { +AvbCmdlineSubstList* avb_new_cmdline_subst_list(void) { return (AvbCmdlineSubstList*)avb_calloc(sizeof(AvbCmdlineSubstList)); } diff --git a/lib/zlib/trees.c b/lib/zlib/trees.c index 970bc5d..e040617 100644 --- a/lib/zlib/trees.c +++ b/lib/zlib/trees.c @@ -237,7 +237,7 @@ local void send_bits(s, value, length) /* =========================================================================== * Initialize the various 'constant' tables. */ -local void tr_static_init() +local void tr_static_init(void) { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0; diff --git a/tools/imx8image.c b/tools/imx8image.c index 395d5c6..c25ea84 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -829,7 +829,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, int ret; int container = -1; - int cont_img_count = 0; /* indexes to arrange the container */ memset((char *)&imx_header, 0, sizeof(imx_header_v3_t)); @@ -879,7 +878,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, img_sp->src = file_off; file_off += ALIGN(sbuf.st_size, sector_size); - cont_img_count++; break; case SECO: @@ -899,7 +897,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, img_sp->src = file_off; file_off += sbuf.st_size; - cont_img_count++; break; case NEW_CONTAINER: @@ -908,8 +905,6 @@ static int build_container(soc_type_t soc, uint32_t sector_size, CONTAINER_ALIGNMENT, CONTAINER_FLAGS_DEFAULT, fuse_version); - /* reset img count when moving to new container */ - cont_img_count = 0; scfw_flags = 0; break; diff --git a/tools/proftool.c b/tools/proftool.c index 0893604..101bcb6 100644 --- a/tools/proftool.c +++ b/tools/proftool.c @@ -1713,18 +1713,11 @@ static int make_flame_tree(enum out_format_t out_format, struct flame_state state; struct flame_node *tree; struct trace_call *call; - int missing_count = 0; - int i, depth; + int i; /* maintain a stack of start times, etc. for 'calling' functions */ state.stack_ptr = 0; - /* - * The first thing in the trace may not be the top-level function, so - * set the initial depth so that no function goes below depth 0 - */ - depth = -calc_min_depth(); - tree = create_node("tree"); if (!tree) return -1; @@ -1736,16 +1729,10 @@ static int make_flame_tree(enum out_format_t out_format, ulong timestamp = call->flags & FUNCF_TIMESTAMP_MASK; struct func_info *func; - if (entry) - depth++; - else - depth--; - func = find_func_by_offset(call->func); if (!func) { warn("Cannot find function at %lx\n", text_offset + call->func); - missing_count++; continue; } |