Hi, On 8/8/19 6:44 AM, Bin Meng wrote: > When CADENCE_GEM_ERR_DEBUG is turned on, there are several > compilation errors in DB_PRINT(). Fix them. > > Signed-off-by: Bin Meng <bmeng...@gmail.com> > > --- > > Changes in v2:
Please don't reply to previous version, post as a new thread (it is harder to notice your new versions in a emails threaded view). > - use HWADDR_PRIx instead of TARGET_FMT_plx for consistency > - use 'z' modifier to print sizeof(..) > > hw/net/cadence_gem.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c > index d412085..b6ff2c1 100644 > --- a/hw/net/cadence_gem.c > +++ b/hw/net/cadence_gem.c > @@ -983,8 +983,9 @@ static ssize_t gem_receive(NetClientState *nc, const > uint8_t *buf, size_t size) > return -1; > } > > - DB_PRINT("copy %d bytes to 0x%x\n", MIN(bytes_to_copy, rxbufsize), > - rx_desc_get_buffer(s->rx_desc[q])); > + DB_PRINT("copy %d bytes to 0x%" HWADDR_PRIx "\n", rx_desc_get_buffer() returns a uint64_t, shouldn't you use a PRIx64 format here? > + MIN(bytes_to_copy, rxbufsize), Nitpick #1: since you are cleaning this file up, bytes_to_copy and rxbufsize are both unsigned, so the first format should be %u instead of %d. > + rx_desc_get_buffer(s, s->rx_desc[q])); > > /* Copy packet data to emulated DMA buffer */ > address_space_write(&s->dma_as, rx_desc_get_buffer(s, s->rx_desc[q]) > + > @@ -1157,7 +1158,7 @@ static void gem_transmit(CadenceGEMState *s) > if (tx_desc_get_length(desc) > sizeof(tx_packet) - > (p - tx_packet)) { > DB_PRINT("TX descriptor @ 0x%x too large: size 0x%x space " \ > - "0x%x\n", (unsigned)packet_desc_addr, > + "0x%zx\n", (unsigned)packet_desc_addr, Nitpick #2: packet_desc_addr is of type hwaddr, so removing the cast the 1st format is HWADDR_PRIx, also removing the 2nd cast the 2nd format is PRIx64. Then the 3rd format is now correct. > (unsigned)tx_desc_get_length(desc), > sizeof(tx_packet) - (p - tx_packet)); > break; >