From: Marek Vasut Date: Fri, 6 Jul 2018 10:06:21 +0200 Subject: [U-Boot] [PATCH v3] spi: cadence_qspi: Fix compilation warning In-Reply-To: <1530844754-45510-1-git-send-email-ley.foon.tan@intel.com> References: <1530844754-45510-1-git-send-email-ley.foon.tan@intel.com> Message-ID: <5837f85d-62d1-20e9-895f-3cb4dc665e8a@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On 07/06/2018 04:39 AM, Ley Foon Tan wrote: > Use "%zu" for size_t data type. > > Compilation warning as below: > > In file included from include/linux/bug.h:7:0, > from include/common.h:26, > from drivers/spi/cadence_qspi.c:8: > drivers/spi/cadence_qspi.c: In function ‘cadence_spi_xfer’: > drivers/spi/cadence_qspi.c:211:8: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=] > debug("%s: len=%d [bytes]\n", __func__, data_bytes); > ^ > include/linux/printk.h:37:21: note: in definition of macro ‘pr_fmt’ > #define pr_fmt(fmt) fmt > ^~~ > include/log.h:142:2: note: in expansion of macro ‘debug_cond’ > debug_cond(_DEBUG, fmt, ##args) > ^~~~~~~~~~ > drivers/spi/cadence_qspi.c:211:2: note: in expansion of macro ‘debug’ > debug("%s: len=%d [bytes]\n", __func__, data_bytes); > > Signed-off-by: Ley Foon Tan > Acked-by: Marek Vasut I replaced the V2 with this in u-boot-socfpga/master, so let's see. > --- > > v1: Cast data_byte to integet > v2: Use "%lu" > v3: Still have compilation warning with "%lu" in Cyclone V build. > So, change to use "%zu" for size_t type. > --- > drivers/spi/cadence_qspi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c > index 91742ba..29db6fa 100644 > --- a/drivers/spi/cadence_qspi.c > +++ b/drivers/spi/cadence_qspi.c > @@ -207,7 +207,7 @@ static int cadence_spi_xfer(struct udevice *dev, unsigned int bitlen, > } else { > data_bytes = bitlen / 8; > } > - debug("%s: len=%d [bytes]\n", __func__, data_bytes); > + debug("%s: len=%zu [bytes]\n", __func__, data_bytes); > > /* Set Chip select */ > cadence_qspi_apb_chipselect(base, spi_chip_select(dev), > -- Best regards, Marek Vasut