Merge branch '2023-05-31-assorted-fixes-and-improvements' into next

- Makefile logic fixes, address some issues that clang uncovers on ARM,
  assorted code cleanups
This commit is contained in:
Tom Rini 2023-06-01 11:23:23 -04:00
commit f415495e2a
18 changed files with 48 additions and 28 deletions

View file

@ -1812,7 +1812,7 @@ quiet_cmd_gen_envp = ENVP $@
rm -f $@; \
touch $@ ; \
fi
include/generated/env.in: include/generated/env.txt FORCE
include/generated/env.in: include/generated/env.txt
$(call cmd,gen_envp)
# Regenerate the environment if it changes
@ -1830,7 +1830,7 @@ quiet_cmd_envc = ENVC $@
touch $@ ; \
fi
include/generated/env.txt: $(wildcard $(ENV_FILE)) FORCE
include/generated/env.txt: $(wildcard $(ENV_FILE))
$(call cmd,envc)
# Write out the resulting environment, converted to a C string

View file

@ -1,7 +1,7 @@
#ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H
#define __ALIGN .align 0
#define __ALIGN_STR ".align 0"
#define __ALIGN .p2align 2
#define __ALIGN_STR ".p2align 2"
#endif

View file

@ -733,7 +733,7 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
gd->fdt_blob = blob;
cfg_noffset = fit_conf_get_node(working_fdt, NULL);
if (!cfg_noffset) {
if (cfg_noffset < 0) {
printf("Could not find configuration node: %s\n",
fdt_strerror(cfg_noffset));
return CMD_RET_FAILURE;

View file

@ -20,7 +20,7 @@ U_BOOT_CMD(
"determine a file's size",
"<interface> <dev[:part]> <filename>\n"
" - Find file 'filename' from 'dev' on 'interface'\n"
" and determine its size."
" determine its size, and store in the 'filesize' variable."
);
static int do_load_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,

View file

@ -88,6 +88,11 @@ int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
return -1;
}
if (*size == 0) {
debug("ERROR: Invalid size 0\n");
return -1;
}
print:
printf("device %d ", *idx);
if (*size == chipsize)

View file

@ -353,6 +353,11 @@ static int do_spi_flash_erase(int argc, char *const argv[])
if (ret != 1)
return CMD_RET_USAGE;
if (size == 0) {
debug("ERROR: Invalid size 0\n");
return CMD_RET_FAILURE;
}
/* Consistency checking */
if (offset + size > flash->size) {
printf("ERROR: attempting %s past flash size (%#x)\n",

View file

@ -19,6 +19,8 @@
U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING
const char version_string[] = U_BOOT_VERSION_STRING;
const unsigned short version_num = U_BOOT_VERSION_NUM;
const unsigned char version_num_patch = U_BOOT_VERSION_NUM_PATCH;
static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])

View file

@ -324,7 +324,7 @@ typedef struct {
/* I can almost use ordinary FILE *. Is open_memstream() universally
* available? Where is it documented? */
struct in_str {
const char *p;
const unsigned char *p;
#ifndef __U_BOOT__
char peek_buf[2];
#endif

View file

@ -331,7 +331,7 @@ static int spl_load_fit_image(struct spl_image_info *spl_image,
conf_noffset = fit_conf_get_node((const void *)header,
fit_uname_config);
if (conf_noffset <= 0)
if (conf_noffset < 0)
return 0;
for (idx = 0;

View file

@ -135,6 +135,7 @@ int dfu_config_interfaces(char *env)
a = s;
do {
part = strsep(&a, ";");
part = skip_spaces(part);
ret = dfu_alt_add(dfu, i, d, part);
if (ret)
return ret;
@ -629,6 +630,7 @@ int dfu_config_entities(char *env, char *interface, char *devstr)
for (i = 0; i < dfu_alt_num; i++) {
s = strsep(&env, ";");
s = skip_spaces(s);
ret = dfu_alt_add(dfu, interface, devstr, s);
if (ret) {
/* We will free "dfu" in dfu_free_entities() */

View file

@ -135,7 +135,7 @@ void fastboot_boot(void)
s = env_get("fastboot_bootcmd");
if (s) {
run_command(s, CMD_FLAG_ENV);
} else {
} else if (IS_ENABLED(CONFIG_CMD_BOOTM)) {
static char boot_addr_start[20];
static char *const bootm_args[] = {
"bootm", boot_addr_start, NULL

View file

@ -2262,7 +2262,7 @@ static int mmc_startup_v4(struct mmc *mmc)
return 0;
if (!mmc->ext_csd)
memset(ext_csd_bkup, 0, sizeof(ext_csd_bkup));
memset(ext_csd_bkup, 0, MMC_MAX_BLOCK_LEN);
err = mmc_send_ext_csd(mmc, ext_csd);
if (err)

View file

@ -57,7 +57,11 @@ static int smh_fs_write_at(const char *filename, loff_t pos, void *buffer,
{
long fd, size, ret;
/* Try to open existing file */
fd = smh_open(filename, MODE_READ | MODE_BINARY | MODE_PLUS);
if (fd < 0)
/* Create new file */
fd = smh_open(filename, MODE_WRITE | MODE_BINARY);
if (fd < 0)
return fd;
ret = smh_seek(fd, pos);

View file

@ -4,5 +4,7 @@
#define __VERSION_STRING_H__
extern const char version_string[];
extern const unsigned short version_num;
extern const unsigned char version_num_patch;
#endif /* __VERSION_STRING_H__ */

View file

@ -11,8 +11,7 @@
#include <log.h>
#include <mapmem.h>
#include <tables_csum.h>
#include <timestamp.h>
#include <version.h>
#include <version_string.h>
#include <acpi/acpi_table.h>
#include <asm/global_data.h>
#include <dm/acpi.h>
@ -25,12 +24,12 @@
* to have valid date. So for U-Boot version 2021.04 OEM_REVISION is set to
* value 0x20210401.
*/
#define OEM_REVISION ((((U_BOOT_VERSION_NUM / 1000) % 10) << 28) | \
(((U_BOOT_VERSION_NUM / 100) % 10) << 24) | \
(((U_BOOT_VERSION_NUM / 10) % 10) << 20) | \
((U_BOOT_VERSION_NUM % 10) << 16) | \
(((U_BOOT_VERSION_NUM_PATCH / 10) % 10) << 12) | \
((U_BOOT_VERSION_NUM_PATCH % 10) << 8) | \
#define OEM_REVISION ((((version_num / 1000) % 10) << 28) | \
(((version_num / 100) % 10) << 24) | \
(((version_num / 10) % 10) << 20) | \
((version_num % 10) << 16) | \
(((version_num_patch / 10) % 10) << 12) | \
((version_num_patch % 10) << 8) | \
0x01)
int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags)

View file

@ -23,6 +23,7 @@ CFLAGS_REMOVE_initrddump.o := $(CFLAGS_NON_EFI)
ifdef CONFIG_RISCV
always += boothart.efi
targets += boothart.o
endif
ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
@ -32,10 +33,12 @@ endif
ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
always += dtbdump.efi
targets += dtbdump.o
endif
ifdef CONFIG_EFI_LOAD_FILE2_INITRD
always += initrddump.efi
targets += initrddump.o
endif
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o

View file

@ -186,7 +186,7 @@ u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
# Modified for U-Boot
dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
$(UBOOTINCLUDE) \
-I$(srctree)/arch/$(ARCH)/dts \
-I$(dir $<) \
-I$(srctree)/arch/$(ARCH)/dts/include \
-I$(srctree)/include \
-D__ASSEMBLY__ \

View file

@ -11,10 +11,8 @@
#include <dm.h>
#include <malloc.h>
#include <mapmem.h>
#include <timestamp.h>
#include <version.h>
#include <tables_csum.h>
#include <version.h>
#include <version_string.h>
#include <acpi/acpigen.h>
#include <acpi/acpi_device.h>
#include <acpi/acpi_table.h>
@ -26,12 +24,12 @@
#define BUF_SIZE 4096
#define OEM_REVISION ((((U_BOOT_VERSION_NUM / 1000) % 10) << 28) | \
(((U_BOOT_VERSION_NUM / 100) % 10) << 24) | \
(((U_BOOT_VERSION_NUM / 10) % 10) << 20) | \
((U_BOOT_VERSION_NUM % 10) << 16) | \
(((U_BOOT_VERSION_NUM_PATCH / 10) % 10) << 12) | \
((U_BOOT_VERSION_NUM_PATCH % 10) << 8) | \
#define OEM_REVISION ((((version_num / 1000) % 10) << 28) | \
(((version_num / 100) % 10) << 24) | \
(((version_num / 10) % 10) << 20) | \
((version_num % 10) << 16) | \
(((version_num_patch / 10) % 10) << 12) | \
((version_num_patch % 10) << 8) | \
0x01)
/**