[Skiboot] [PATCH v5 27/27] Fix simple sparse warnings
Nicholas Piggin
npiggin at gmail.com
Tue Oct 15 14:07:17 AEDT 2019
Should be no real code change, these mostly update type declarations
that sparse complains about.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
core/init.c | 4 ++--
core/pci.c | 2 +-
core/platform.c | 2 +-
hdata/tpmrel.c | 2 +-
hw/fsp/fsp-dpo.c | 2 +-
hw/imc.c | 4 ++--
hw/vas.c | 2 +-
include/device.h | 3 ++-
include/skiboot.h | 2 +-
libc/stdlib/labs.c | 2 +-
platforms/astbmc/common.c | 4 ++--
platforms/astbmc/p8dtu.c | 2 +-
platforms/astbmc/p9dsu.c | 2 +-
platforms/astbmc/witherspoon.c | 6 +++---
14 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/core/init.c b/core/init.c
index 0b63655bc..8b1c8c511 100644
--- a/core/init.c
+++ b/core/init.c
@@ -529,7 +529,7 @@ static int64_t cpu_disable_ME_RI_all(void)
return OPAL_SUCCESS;
}
-void *fdt;
+static void *fdt;
void __noreturn load_and_boot_kernel(bool is_reboot)
{
@@ -797,7 +797,7 @@ static void setup_branch_null_catcher(void)
* ABI v1 (ie. big endian). This will be broken if we ever
* move to ABI v2 (ie little endian)
*/
- memcpy_null(0, bn, 16);
+ memcpy_null((void *)0, bn, 16);
}
#endif
diff --git a/core/pci.c b/core/pci.c
index 4d0671661..59b395919 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1371,7 +1371,7 @@ void pci_std_swizzle_irq_map(struct dt_node *np,
dt_add_property_cells(np, "interrupt-map-mask",
0xf800, 0, 0, 7);
}
- map_size = esize * edevcount * 4 * sizeof(uint32_t);
+ map_size = esize * edevcount * 4 * sizeof(u32);
map = p = zalloc(map_size);
if (!map) {
prerror("Failed to allocate interrupt-map-mask !\n");
diff --git a/core/platform.c b/core/platform.c
index 9f1873c90..2544f0ccf 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -184,7 +184,7 @@ static int generic_start_preload_resource(enum resource_id id, uint32_t subid,
}
/* These values will work for a ZZ booted using BML */
-const struct platform_ocapi generic_ocapi = {
+static const struct platform_ocapi generic_ocapi = {
.i2c_engine = 1,
.i2c_port = 4,
.i2c_reset_addr = 0x20,
diff --git a/hdata/tpmrel.c b/hdata/tpmrel.c
index 1fe14c75e..9796fc732 100644
--- a/hdata/tpmrel.c
+++ b/hdata/tpmrel.c
@@ -118,7 +118,7 @@ static struct dt_node *get_hb_reserved_memory(const char *label)
return NULL;
}
-struct {
+static struct {
uint32_t type;
const char *compat;
} cvc_services[] = {
diff --git a/hw/fsp/fsp-dpo.c b/hw/fsp/fsp-dpo.c
index 0796d9ae9..1f7bacf04 100644
--- a/hw/fsp/fsp-dpo.c
+++ b/hw/fsp/fsp-dpo.c
@@ -18,7 +18,7 @@
#define DPO_CMD_SGN_BYTE1 0x20 /* Byte[1] signature */
#define DPO_TIMEOUT 2700 /* 45 minutes in seconds */
-bool fsp_dpo_pending;
+static bool fsp_dpo_pending;
static unsigned long fsp_dpo_init_tb;
/*
diff --git a/hw/imc.c b/hw/imc.c
index 36c2cf3a5..3a5382c0c 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -455,8 +455,8 @@ static void imc_dt_update_nest_node(struct dt_node *dev)
const struct dt_property *type;
/* Add the base_addr and chip-id properties for the nest node */
- base_addr = malloc(sizeof(uint64_t) * nr_chip);
- chipids = malloc(sizeof(uint32_t) * nr_chip);
+ base_addr = malloc(sizeof(u64) * nr_chip);
+ chipids = malloc(sizeof(u32) * nr_chip);
for_each_chip(chip) {
base_addr[i] = cpu_to_be64(chip->homer_base);
chipids[i] = cpu_to_be32(chip->id);
diff --git a/hw/vas.c b/hw/vas.c
index 82a07904c..3303a12fe 100644
--- a/hw/vas.c
+++ b/hw/vas.c
@@ -457,7 +457,7 @@ static int init_vas_inst(struct dt_node *np, bool enable)
}
-void vas_init()
+void vas_init(void)
{
bool enabled;
struct dt_node *np;
diff --git a/include/device.h b/include/device.h
index 4f7a0983f..f17b089d8 100644
--- a/include/device.h
+++ b/include/device.h
@@ -118,7 +118,8 @@ struct dt_property *__dt_add_property_u64s(struct dt_node *node,
static inline struct dt_property *dt_add_property_u64(struct dt_node *node,
const char *name, u64 val)
{
- return dt_add_property_cells(node, name, (u32)(val >> 32), (u32)val);
+ return dt_add_property_cells(node, name, (u32)(val >> 32),
+ (u32)(val & 0xffffffffUL));
}
void dt_del_property(struct dt_node *node, struct dt_property *prop);
diff --git a/include/skiboot.h b/include/skiboot.h
index 686ba9dc8..4280f28ae 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -318,7 +318,7 @@ extern void fake_rtc_init(void);
struct stack_frame;
extern void exception_entry(struct stack_frame *stack);
extern void exception_entry_pm_sreset(void);
-extern void exception_entry_pm_mce(void);
+extern void __noreturn exception_entry_pm_mce(void);
/* Assembly in head.S */
extern void disable_machine_check(void);
diff --git a/libc/stdlib/labs.c b/libc/stdlib/labs.c
index 9b68bb275..8bd15eab9 100644
--- a/libc/stdlib/labs.c
+++ b/libc/stdlib/labs.c
@@ -19,7 +19,7 @@
* Returns the absolute value of the long integer argument
*/
-long int labs(long int n)
+long int __attribute__((const)) labs(long int n)
{
return (n > 0) ? n : -n;
}
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 15ac231fb..de837f326 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -503,13 +503,13 @@ void astbmc_exit(void)
ipmi_wdt_final_reset();
}
-const struct bmc_sw_config bmc_sw_ami = {
+static const struct bmc_sw_config bmc_sw_ami = {
.ipmi_oem_partial_add_esel = IPMI_CODE(0x3a, 0xf0),
.ipmi_oem_pnor_access_status = IPMI_CODE(0x3a, 0x07),
.ipmi_oem_hiomap_cmd = IPMI_CODE(0x3a, 0x5a),
};
-const struct bmc_sw_config bmc_sw_openbmc = {
+static const struct bmc_sw_config bmc_sw_openbmc = {
.ipmi_oem_partial_add_esel = IPMI_CODE(0x3a, 0xf0),
.ipmi_oem_hiomap_cmd = IPMI_CODE(0x3a, 0x5a),
};
diff --git a/platforms/astbmc/p8dtu.c b/platforms/astbmc/p8dtu.c
index c62223b24..a9d8dc068 100644
--- a/platforms/astbmc/p8dtu.c
+++ b/platforms/astbmc/p8dtu.c
@@ -223,7 +223,7 @@ static const struct bmc_sw_config bmc_sw_smc = {
};
/* Provided by Eric Chen (SMC) */
-const struct bmc_hw_config p8dtu_bmc_hw = {
+static const struct bmc_hw_config p8dtu_bmc_hw = {
.scu_revision_id = 0x02010303,
.mcr_configuration = 0x00000577,
.mcr_scu_mpll = 0x000050c0,
diff --git a/platforms/astbmc/p9dsu.c b/platforms/astbmc/p9dsu.c
index d49f7fe07..5c9756ec6 100644
--- a/platforms/astbmc/p9dsu.c
+++ b/platforms/astbmc/p9dsu.c
@@ -695,7 +695,7 @@ static const struct bmc_sw_config bmc_sw_smc = {
};
/* Provided by Eric Chen (SMC) */
-const struct bmc_hw_config p9dsu_bmc_hw = {
+static const struct bmc_hw_config p9dsu_bmc_hw = {
.scu_revision_id = 0x04030303,
.mcr_configuration = 0x11000756,
.mcr_scu_mpll = 0x000071c1,
diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/witherspoon.c
index 8aaed975f..edf84fb89 100644
--- a/platforms/astbmc/witherspoon.c
+++ b/platforms/astbmc/witherspoon.c
@@ -325,7 +325,7 @@ i2c_failed:
return;
}
-const struct platform_ocapi witherspoon_ocapi = {
+static const struct platform_ocapi witherspoon_ocapi = {
.i2c_engine = 1,
.i2c_port = 4,
.odl_phy_swap = false,
@@ -370,8 +370,8 @@ static int gpu_slot_to_num(const char *slot)
static void npu2_phb_nvlink_dt(struct phb *npuphb)
{
- struct dt_node *g[3] = { 0 }; /* Current maximum is 3 GPUs per 1 NPU */
- struct dt_node *n[6] = { 0 };
+ struct dt_node *g[3] = { NULL }; /* Current maximum 3 GPUs per 1 NPU */
+ struct dt_node *n[6] = { NULL };
int max_gpus, i, gpuid, first, last;
struct npu2 *npu2_phb = phb_to_npu2_nvlink(npuphb);
struct pci_device *npd;
--
2.23.0
More information about the Skiboot
mailing list