trivial: Small fixups from compiler warnings - Use correct printf format strings - Remove unused symbols - Move variable initializations around to avoid uninitialized usages - Add missing const modifiers - Correct slightly invalid type definitions - Remove unsupported attribute: force
diff --git a/libplatsupportports/src/plat/tx2/clock.c b/libplatsupportports/src/plat/tx2/clock.c index db2f883..f29c9b1 100644 --- a/libplatsupportports/src/plat/tx2/clock.c +++ b/libplatsupportports/src/plat/tx2/clock.c
@@ -116,7 +116,7 @@ clk_t *ret_clk = NULL; tx2_clk_t *tx2_clk = clock_sys->priv; - + size_t clk_name_len = 0; int error = ps_calloc(&tx2_clk->io_ops->malloc_ops, 1, sizeof(*ret_clk), (void **) &ret_clk); if (error) { ZF_LOGE("Failed to allocate memory for the clock structure"); @@ -144,7 +144,7 @@ ZF_LOGE("Failed to initialise the clock"); goto fail; } - size_t clk_name_len = strlen((char *) res.clk_get_all_info.name) + 1; + clk_name_len = strlen((char *) res.clk_get_all_info.name) + 1; error = ps_calloc(&tx2_clk->io_ops->malloc_ops, 1, sizeof(char) * clk_name_len, (void **) &clock_name); if (error) { ZF_LOGE("Failed to allocate memory for the name of the clock"); @@ -205,6 +205,7 @@ int error = 0; tx2_clk_t *clk = NULL; + void *car_vaddr = NULL; error = ps_calloc(&io_ops->malloc_ops, 1, sizeof(tx2_clk_t), (void **) &clock_sys->priv); if (error) { @@ -215,7 +216,6 @@ clk = clock_sys->priv; - void *car_vaddr = NULL; car_vaddr = ps_io_map(&io_ops->io_mapper, TX2_CLKCAR_PADDR, TX2_CLKCAR_SIZE, 0, PS_MEM_NORMAL); if (car_vaddr == NULL) { ZF_LOGE("Failed to map tx2 CAR registers");
diff --git a/libplatsupportports/src/plat/tx2/mux.c b/libplatsupportports/src/plat/tx2/mux.c index b84563a..da2e269 100644 --- a/libplatsupportports/src/plat/tx2/mux.c +++ b/libplatsupportports/src/plat/tx2/mux.c
@@ -223,7 +223,7 @@ return (volatile uint32_t *)(regs + mux_reg_offset + offset); } -static int tx2_mux_set_pin_params(mux_sys_t *mux, struct tx2_mux_pin_desc *desc, enum mux_gpio_dir dir) +static int tx2_mux_set_pin_params(const mux_sys_t *mux, struct tx2_mux_pin_desc *desc, enum mux_gpio_dir dir) { volatile uint32_t *pin_reg = tx2_mux_get_register(mux->priv, desc->mux_reg_offset, CONTROL_REGISTER); @@ -328,7 +328,7 @@ } -static int tx2_mux_feature_enable(mux_sys_t *mux, mux_feature_t feature, enum mux_gpio_dir dir) +static int tx2_mux_feature_enable(const mux_sys_t *mux, mux_feature_t feature, enum mux_gpio_dir dir) { int error = 0; @@ -356,7 +356,7 @@ error = tx2_mux_set_pin_params(mux, &map->pins[i], dir); if (error) { - ZF_LOGE("Failed to set pinmux params for pin %d of feature %d", i, feature); + ZF_LOGE("Failed to set pinmux params for pin %d of feature %zd", i, feature); return error; } } @@ -364,7 +364,7 @@ return 0; } -static inline void tx2_mux_disable_pin(mux_sys_t *mux, struct tx2_mux_pin_desc *desc) +static inline void tx2_mux_disable_pin(const mux_sys_t *mux, struct tx2_mux_pin_desc *desc) { /* 8.29.3 of the TRM: * For each unused MPIO, assert its tristate (TRISTATE_CONTROL) bit and @@ -382,10 +382,8 @@ assert(*pin_reg == (MUX_REG_TRISTATE_TRISTATE << MUX_REG_TRISTATE_SHIFT)); } -static int tx2_mux_feature_disable(mux_sys_t *mux, mux_feature_t feature) +static int tx2_mux_feature_disable(const mux_sys_t *mux, mux_feature_t feature) { - int error = 0; - if (!is_valid_feature(feature)) { return -EINVAL; }
diff --git a/libplatsupportports/src/plat/tx2/reset.c b/libplatsupportports/src/plat/tx2/reset.c index 75fb8f1..39315f4 100644 --- a/libplatsupportports/src/plat/tx2/reset.c +++ b/libplatsupportports/src/plat/tx2/reset.c
@@ -85,7 +85,6 @@ } int error = 0; - bool bpmp_allocated = false; tx2_reset_t *reset = NULL; error = ps_calloc(&io_ops->malloc_ops, 1, sizeof(tx2_reset_t), (void **) &reset_sys->data); if (error) {
diff --git a/libtx2bpmp/src/ivc.c b/libtx2bpmp/src/ivc.c index f63c929..dea84d3 100644 --- a/libtx2bpmp/src/ivc.c +++ b/libtx2bpmp/src/ivc.c
@@ -29,7 +29,7 @@ #define TEGRA_IVC_ALIGN 64 #define __ACCESS_ONCE(x) ({ \ - UNUSED typeof(x) __var = (__attribute__((force)) typeof(x)) 0; \ + UNUSED typeof(x) __var = (typeof(x)) 0; \ (volatile typeof(x) *)&(x); }) #define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) @@ -448,7 +448,7 @@ ZF_LOGF_IF(OFFSETOF(struct tegra_ivc_channel_header, r_count) & (TEGRA_IVC_ALIGN - 1), "r_count is not properly aligned to %d", TEGRA_IVC_ALIGN); ZF_LOGF_IF(sizeof(struct tegra_ivc_channel_header) & (TEGRA_IVC_ALIGN - 1), - "sizeof(struct tegre_ivc_channel_header) = %d is not algined to %d", + "sizeof(struct tegre_ivc_channel_header) = %zd is not algined to %d", sizeof(struct tegra_ivc_channel_header), TEGRA_IVC_ALIGN); if ((uint64_t)nframes * (uint64_t)frame_size >= 0x100000000) {
diff --git a/libvirtqueue/src/virtqueue.c b/libvirtqueue/src/virtqueue.c index e0631a0..dd24a41 100644 --- a/libvirtqueue/src/virtqueue.c +++ b/libvirtqueue/src/virtqueue.c
@@ -118,15 +118,6 @@ return next; } -static void vq_free_chain(virtqueue_driver_t *vq, unsigned head) -{ - while (head != vq->queue_len) { - vq->desc_table[head].next = vq->free_desc_head; - vq->free_desc_head = head; - head = vq->desc_table[head].next; - } -} - int virtqueue_add_available_buf(virtqueue_driver_t *vq, virtqueue_ring_object_t *obj, void *buf, unsigned len, vq_flags_t flag) {
diff --git a/libvswitch/src/vswitch.c b/libvswitch/src/vswitch.c index 914e805..a27c13d 100644 --- a/libvswitch/src/vswitch.c +++ b/libvswitch/src/vswitch.c
@@ -50,7 +50,7 @@ virtqueue_driver_t *send_virtqueue, virtqueue_device_t *recv_virtqueue) { - int slot, err; + int slot; assert(lib->n_connected <= VSWITCH_NUM_NODES);