Merge branch '2023-03-22-assorted-minor-code-cleanups' into next

- Minor code cleanups based on problems found by clang or enabling LTO.
This commit is contained in:
Tom Rini 2023-03-22 20:57:39 -04:00
commit 884d626d83
16 changed files with 40 additions and 32 deletions

View file

@ -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.

View file

@ -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);

View file

@ -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>

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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();

View file

@ -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)
{
}

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -466,6 +466,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
*

View file

@ -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));
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}