diff options
author | Marc Zyngier <maz@kernel.org> | 2023-09-17 14:07:47 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2023-09-17 14:07:47 +0100 |
commit | c70e00cf01acf689557700b1ad0fc6de52c3f6d7 (patch) | |
tree | 889373a625da09141c3993df380fde9809579420 | |
parent | ed219367d8396c5cfc554c53fb59470444eaeb57 (diff) | |
download | cs-sw-c70e00cf01acf689557700b1ad0fc6de52c3f6d7.tar.gz |
Enable -Wall and fix warnings
Having just realised that -Wall wasn't set (WTF???), switch it
on and mop the floor...
Signed-off-by: Marc Zyngier <maz@kernel.org>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | start.c | 4 | ||||
-rw-r--r-- | tcpm_driver.c | 5 | ||||
-rw-r--r-- | vdmtool.c | 12 |
4 files changed, 11 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f0e853c..0029ab0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR} ) +target_compile_options(${PROJECT_NAME} PRIVATE -Wall -funsigned-char) + # Create map/bin/hex/uf2 files pico_add_extra_outputs(${PROJECT_NAME}) @@ -149,7 +149,7 @@ static void __not_in_flash_func(uart_irq_fn)(int port, const struct hw_context *hw) { while (uart_is_readable(hw->uart)) { - char c = uart_getc(hw->uart); + const char c = uart_getc(hw->uart); upstream_ops->tx_bytes(port, &c, 1); } } @@ -299,7 +299,7 @@ static const struct upstream_ops usb_upstream_ops = { static void serial1_tx_bytes(int32_t port, const char *ptr, int len) { - uart_write_blocking(uart1, ptr, len); + uart_write_blocking(uart1, (const uint8_t *)ptr, len); } static int32_t serial1_rx_byte(int32_t port) diff --git a/tcpm_driver.c b/tcpm_driver.c index fd78712..5d636a8 100644 --- a/tcpm_driver.c +++ b/tcpm_driver.c @@ -69,9 +69,8 @@ int16_t tcpc_xfer(int16_t port, const struct hw_context *fusb = get_hw_from_port(port); if (out_size) { - int err; - err = i2c_write_blocking(fusb->i2c, fusb->addr, out, out_size, - !(flags & I2C_XFER_STOP)); + i2c_write_blocking(fusb->i2c, fusb->addr, out, out_size, + !(flags & I2C_XFER_STOP)); } if (in_size) { @@ -50,7 +50,7 @@ static struct vdm_context vdm_contexts[CONFIG_USB_PD_PORT_COUNT]; #define cprintf(cxt, str, ...) do { \ cprintf_cont(cxt, \ - "P%ld: " str, PORT(cxt), ##__VA_ARGS__); \ + "P%d: " str, PORT(cxt), ##__VA_ARGS__); \ } while(0) #define dprintf(cxt, ...) do { \ @@ -195,7 +195,7 @@ static void dump_msg(struct vdm_context *cxt, cprintf_cont(cxt, "%d) [%x]", len, hdr); for (int16_t i = 0; i < PD_HEADER_CNT(hdr); i++) - cprintf_cont(cxt, " %x", msg[i]); + cprintf_cont(cxt, " %lx", msg[i]); cprintf_cont(cxt, "\n"); } @@ -275,11 +275,11 @@ static void handle_msg(struct vdm_context *cxt, enum fusb302_rxfifo_tokens sop, if (len != 0) { switch (type) { case PD_DATA_SOURCE_CAP: - cprintf(cxt, "<SOURCE_CAP: %x\n", msg[0]); + cprintf(cxt, "<SOURCE_CAP: %lx\n", msg[0]); send_power_request(cxt, msg[0]); break; case PD_DATA_REQUEST: - cprintf(cxt, "<REQUEST: %x\n", msg[0]); + cprintf(cxt, "<REQUEST: %lx\n", msg[0]); handle_power_request(cxt, msg[0]); break; case PD_DATA_VENDOR_DEF: @@ -323,7 +323,7 @@ static void handle_msg(struct vdm_context *cxt, enum fusb302_rxfifo_tokens sop, static void evt_packet(struct vdm_context *cxt) { - int16_t hdr, len, ret; + int16_t hdr, ret; enum fusb302_rxfifo_tokens sop; uint32_t msg[16]; @@ -730,8 +730,6 @@ static bool m1_pd_bmc_run_one(struct vdm_context *cxt) void m1_pd_bmc_run(void) { - int i; - while (1) { bool busy = false; |