openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] FSI warning fixes
@ 2018-06-18  3:43 Joel Stanley
  2018-06-18  3:43 ` [PATCH 1/5] fsi-occ: Fix size_t printf Joel Stanley
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Joel Stanley @ 2018-06-18  3:43 UTC (permalink / raw)
  To: openbmc, Benjamin Herrenschmidt, Eddie James

Hi Eddie and Ben,

I've fixed a bunch of printf warnings (that only occur when the kernel
is being built for a 64 bit machine) and sparse warnings.

Where appropraite please fold these fixes into your work in progress
code.

(This is with the work in progress 4.17 tree, which contains all of the
posted fixes, plus a mega-patch that I created with all of the OCC HWMON
work).

Joel Stanley (5):
  fsi-occ: Fix size_t printf
  hwmon (occ): Fix printf warning
  fsi: sbefifo: Fix sparse warnings
  fsi: master-hub: Fix sparse warnings
  fsi: core: Fix sparse warnings

 drivers/fsi/fsi-core.c       | 23 +++++++++++++----------
 drivers/fsi/fsi-master-hub.c |  5 +++--
 drivers/fsi/fsi-occ.c        |  2 +-
 drivers/fsi/fsi-sbefifo.c    |  5 +++--
 drivers/hwmon/occ/common.c   |  2 +-
 5 files changed, 21 insertions(+), 16 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] fsi-occ: Fix size_t printf
  2018-06-18  3:43 [PATCH 0/5] FSI warning fixes Joel Stanley
@ 2018-06-18  3:43 ` Joel Stanley
  2018-06-18  4:30   ` Benjamin Herrenschmidt
  2018-06-18  3:43 ` [PATCH 2/5] hwmon (occ): Fix printf warning Joel Stanley
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Joel Stanley @ 2018-06-18  3:43 UTC (permalink / raw)
  To: openbmc, Benjamin Herrenschmidt, Eddie James

   drivers/fsi/fsi-occ.c:414:16: warning: format '%d' expects argument
   of type 'int', but argument 4 has type 'size_t {aka long unsigned
   int}' [-Wformat=]
      dev_dbg(dev, "Bad resplen %d\n", *resp_len);
                   ^                   ~~

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-occ.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index e4ebda646453..f02f72d379d0 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -411,7 +411,7 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,
 	if (!occ)
 		return -ENODEV;
 	if (*resp_len < 7) {
-		dev_dbg(dev, "Bad resplen %d\n", *resp_len);
+		dev_dbg(dev, "Bad resplen %zd\n", *resp_len);
 		return -EINVAL;
 	}
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] hwmon (occ): Fix printf warning
  2018-06-18  3:43 [PATCH 0/5] FSI warning fixes Joel Stanley
  2018-06-18  3:43 ` [PATCH 1/5] fsi-occ: Fix size_t printf Joel Stanley
@ 2018-06-18  3:43 ` Joel Stanley
  2018-06-18  3:43 ` [PATCH 3/5] fsi: sbefifo: Fix sparse warnings Joel Stanley
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Joel Stanley @ 2018-06-18  3:43 UTC (permalink / raw)
  To: openbmc, Benjamin Herrenschmidt, Eddie James

   drivers/hwmon/occ/common.c:1351:24: warning: format '%d' expects
   argument of type 'int', but argument 5 has type 'long unsigned int'
   [-Wformat=]
     dev_dbg(occ->bus_dev, "Max resp size: %d+%d=%d\n",

   drivers/hwmon/occ/common.c:1351:24: warning: format ‘%d’ expects
   argument of type ‘int’, but argument 6 has type ‘long unsigned int’
   [-Wformat=]
     dev_dbg(occ->bus_dev, "Max resp size: %u+%zd=%d\n",

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/hwmon/occ/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index c1bccf53b425..c5115a049032 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -1348,7 +1348,7 @@ static void occ_parse_poll_response(struct occ *occ)
 		sensor->version = block->header.sensor_format;
 		sensor->data = &block->data;
 	}
-	dev_dbg(occ->bus_dev, "Max resp size: %d+%d=%d\n",
+	dev_dbg(occ->bus_dev, "Max resp size: %u+%zd=%zd\n",
 		 size, sizeof(*header), size + sizeof(*header));
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] fsi: sbefifo: Fix sparse warnings
  2018-06-18  3:43 [PATCH 0/5] FSI warning fixes Joel Stanley
  2018-06-18  3:43 ` [PATCH 1/5] fsi-occ: Fix size_t printf Joel Stanley
  2018-06-18  3:43 ` [PATCH 2/5] hwmon (occ): Fix printf warning Joel Stanley
@ 2018-06-18  3:43 ` Joel Stanley
  2018-06-18  3:43 ` [PATCH 4/5] fsi: master-hub: " Joel Stanley
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Joel Stanley @ 2018-06-18  3:43 UTC (permalink / raw)
  To: openbmc, Benjamin Herrenschmidt, Eddie James

fsi-sbefifo.c:547:58: warning: incorrect type in argument 2 (different base types)
fsi-sbefifo.c:547:58:    expected restricted __be32 [usertype] *word
fsi-sbefifo.c:547:58:    got unsigned int *<noident>
fsi-sbefifo.c:635:16: warning: incorrect type in assignment (different base types)
fsi-sbefifo.c:635:16:    expected unsigned int [unsigned] <noident>
fsi-sbefifo.c:635:16:    got restricted __be32 [usertype] <noident>
fsi-sbefifo.c:636:16: warning: incorrect type in assignment (different base types)
fsi-sbefifo.c:636:16:    expected unsigned int [unsigned] <noident>
fsi-sbefifo.c:636:16:    got restricted __be32 [usertype] <noident>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-sbefifo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index e6882a2b1709..4f076fd2939c 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -519,9 +519,10 @@ static int sbefifo_send_command(struct sbefifo *sbefifo,
 static int sbefifo_read_response(struct sbefifo *sbefifo, struct iov_iter *response)
 {
 	struct device *dev = &sbefifo->fsi_dev->dev;
-	u32 data, status, eot_set;
+	u32 status, eot_set;
 	unsigned long timeout;
 	bool overflow = false;
+	__be32 data;
 	size_t len;
 	int rc;
 
@@ -619,7 +620,7 @@ static void sbefifo_collect_async_ffdc(struct sbefifo *sbefifo)
         struct kvec ffdc_iov;
 	__be32 *ffdc;
 	size_t ffdc_sz;
-	u32 cmd[2];
+	__be32 cmd[2];
 	int rc;
 
 	sbefifo->async_ffdc = false;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] fsi: master-hub: Fix sparse warnings
  2018-06-18  3:43 [PATCH 0/5] FSI warning fixes Joel Stanley
                   ` (2 preceding siblings ...)
  2018-06-18  3:43 ` [PATCH 3/5] fsi: sbefifo: Fix sparse warnings Joel Stanley
@ 2018-06-18  3:43 ` Joel Stanley
  2018-06-18  3:43 ` [PATCH 5/5] fsi: core: " Joel Stanley
  2018-06-18  4:32 ` [PATCH 0/5] FSI warning fixes Benjamin Herrenschmidt
  5 siblings, 0 replies; 8+ messages in thread
From: Joel Stanley @ 2018-06-18  3:43 UTC (permalink / raw)
  To: openbmc, Benjamin Herrenschmidt, Eddie James

fsi-master-hub.c:128:13: warning: incorrect type in assignment (different base types)
fsi-master-hub.c:128:13:    expected unsigned int [unsigned] [usertype] cmd
fsi-master-hub.c:128:13:    got restricted __be32 [usertype] <noident>
fsi-master-hub.c:208:13: warning: incorrect type in assignment (different base types)
fsi-master-hub.c:208:13:    expected restricted __be32 [addressable] [assigned] [usertype] reg
fsi-master-hub.c:208:13:    got int

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-master-hub.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c
index 5885fc4a1ef0..b3c1e9debcf2 100644
--- a/drivers/fsi/fsi-master-hub.c
+++ b/drivers/fsi/fsi-master-hub.c
@@ -122,7 +122,8 @@ static int hub_master_write(struct fsi_master *master, int link,
 
 static int hub_master_break(struct fsi_master *master, int link)
 {
-	uint32_t addr, cmd;
+	uint32_t addr;
+	__be32 cmd;
 
 	addr = 0x4;
 	cmd = cpu_to_be32(0xc0de0000);
@@ -205,7 +206,7 @@ static int hub_master_init(struct fsi_master_hub *hub)
 	if (rc)
 		return rc;
 
-	reg = ~0;
+	reg = cpu_to_be32(~0);
 	rc = fsi_device_write(dev, FSI_MSENP0, &reg, sizeof(reg));
 	if (rc)
 		return rc;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] fsi: core: Fix sparse warnings
  2018-06-18  3:43 [PATCH 0/5] FSI warning fixes Joel Stanley
                   ` (3 preceding siblings ...)
  2018-06-18  3:43 ` [PATCH 4/5] fsi: master-hub: " Joel Stanley
@ 2018-06-18  3:43 ` Joel Stanley
  2018-06-18  4:32 ` [PATCH 0/5] FSI warning fixes Benjamin Herrenschmidt
  5 siblings, 0 replies; 8+ messages in thread
From: Joel Stanley @ 2018-06-18  3:43 UTC (permalink / raw)
  To: openbmc, Benjamin Herrenschmidt, Eddie James

fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:210:9: warning: cast to restricted __be32
fsi-core.c:606:15: warning: incorrect type in assignment (different base types)
fsi-core.c:606:15:    expected unsigned int [unsigned] [assigned] [usertype] smode
fsi-core.c:606:15:    got restricted __be32 [usertype] <noident>
fsi-core.c:492:28: warning: expression using sizeof(void)
fsi-core.c:520:29: warning: expression using sizeof(void)
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:682:19: warning: cast to restricted __be32
fsi-core.c:706:24: warning: incorrect type in assignment (different base types)
fsi-core.c:706:24:    expected unsigned int [unsigned] [usertype] llmode
fsi-core.c:706:24:    got restricted __be32 [usertype] <noident>

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-core.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 4c03d6933646..a3f0d41f4c59 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -190,7 +190,7 @@ static int fsi_slave_calc_addr(struct fsi_slave *slave, uint32_t *addrp,
 static int fsi_slave_report_and_clear_errors(struct fsi_slave *slave)
 {
 	struct fsi_master *master = slave->master;
-	uint32_t irq, stat;
+	__be32 irq, stat;
 	int rc, link;
 	uint8_t id;
 
@@ -390,7 +390,6 @@ static struct device_node *fsi_device_find_of_node(struct fsi_device *dev)
 static int fsi_slave_scan(struct fsi_slave *slave)
 {
 	uint32_t engine_addr;
-	uint32_t conf;
 	int rc, i;
 
 	/*
@@ -404,15 +403,17 @@ static int fsi_slave_scan(struct fsi_slave *slave)
 	for (i = 2; i < engine_page_size / sizeof(uint32_t); i++) {
 		uint8_t slots, version, type, crc;
 		struct fsi_device *dev;
+		uint32_t conf;
+		__be32 data;
 
-		rc = fsi_slave_read(slave, (i + 1) * sizeof(conf),
-				&conf, sizeof(conf));
+		rc = fsi_slave_read(slave, (i + 1) * sizeof(data),
+				&data, sizeof(data));
 		if (rc) {
 			dev_warn(&slave->dev,
 				"error reading slave registers\n");
 			return -1;
 		}
-		conf = be32_to_cpu(conf);
+		conf = be32_to_cpu(data);
 
 		crc = crc4(0, conf, 32);
 		if (crc) {
@@ -597,15 +598,16 @@ static uint32_t fsi_slave_smode(int id)
 static int fsi_slave_set_smode(struct fsi_master *master, int link, int id)
 {
 	uint32_t smode;
+	__be32 data;
 
 	/* set our smode register with the slave ID field to 0; this enables
 	 * extended slave addressing
 	 */
 	smode = fsi_slave_smode(id);
-	smode = cpu_to_be32(smode);
+	data = cpu_to_be32(smode);
 
 	return fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SMODE,
-			&smode, sizeof(smode));
+			&data, sizeof(data));
 }
 
 static void fsi_slave_release(struct device *dev)
@@ -661,9 +663,10 @@ static struct device_node *fsi_slave_find_of_node(struct fsi_master *master,
 
 static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
 {
-	uint32_t chip_id, llmode;
+	uint32_t chip_id;
 	struct fsi_slave *slave;
 	uint8_t crc;
+	__be32 data, llmode;
 	int rc;
 
 	/* Currently, we only support single slaves on a link, and use the
@@ -672,13 +675,13 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
 	if (id != 0)
 		return -EINVAL;
 
-	rc = fsi_master_read(master, link, id, 0, &chip_id, sizeof(chip_id));
+	rc = fsi_master_read(master, link, id, 0, &data, sizeof(data));
 	if (rc) {
 		dev_dbg(&master->dev, "can't read slave %02x:%02x %d\n",
 				link, id, rc);
 		return -ENODEV;
 	}
-	chip_id = be32_to_cpu(chip_id);
+	chip_id = be32_to_cpu(data);
 
 	crc = crc4(0, chip_id, 32);
 	if (crc) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] fsi-occ: Fix size_t printf
  2018-06-18  3:43 ` [PATCH 1/5] fsi-occ: Fix size_t printf Joel Stanley
@ 2018-06-18  4:30   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2018-06-18  4:30 UTC (permalink / raw)
  To: Joel Stanley, openbmc, Eddie James

On Mon, 2018-06-18 at 13:13 +0930, Joel Stanley wrote:
>    drivers/fsi/fsi-occ.c:414:16: warning: format '%d' expects argument
>    of type 'int', but argument 4 has type 'size_t {aka long unsigned
>    int}' [-Wformat=]
>       dev_dbg(dev, "Bad resplen %d\n", *resp_len);
>                    ^                   ~~

Thanks, I've already pushed an equivalent fix in my branch, I'll let
Eddie pick it up for the next upstream submission.

> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  drivers/fsi/fsi-occ.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
> index e4ebda646453..f02f72d379d0 100644
> --- a/drivers/fsi/fsi-occ.c
> +++ b/drivers/fsi/fsi-occ.c
> @@ -411,7 +411,7 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,
>  	if (!occ)
>  		return -ENODEV;
>  	if (*resp_len < 7) {
> -		dev_dbg(dev, "Bad resplen %d\n", *resp_len);
> +		dev_dbg(dev, "Bad resplen %zd\n", *resp_len);
>  		return -EINVAL;
>  	}
>  

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/5] FSI warning fixes
  2018-06-18  3:43 [PATCH 0/5] FSI warning fixes Joel Stanley
                   ` (4 preceding siblings ...)
  2018-06-18  3:43 ` [PATCH 5/5] fsi: core: " Joel Stanley
@ 2018-06-18  4:32 ` Benjamin Herrenschmidt
  5 siblings, 0 replies; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2018-06-18  4:32 UTC (permalink / raw)
  To: Joel Stanley, openbmc, Eddie James

On Mon, 2018-06-18 at 13:13 +0930, Joel Stanley wrote:
> Hi Eddie and Ben,
> 
> I've fixed a bunch of printf warnings (that only occur when the kernel
> is being built for a 64 bit machine) and sparse warnings.
> 
> Where appropraite please fold these fixes into your work in progress
> code.
> 
> (This is with the work in progress 4.17 tree, which contains all of the
> posted fixes, plus a mega-patch that I created with all of the OCC HWMON
> work).

So those:

>   fsi: sbefifo: Fix sparse warnings
>   fsi: master-hub: Fix sparse warnings
>   fsi: core: Fix sparse warnings

Fix stuff that is either already upstream or already in a tagged pull
request. I'll add those 3 fixes on top of them in k.org for my next
pull request to Greg.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-18  4:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18  3:43 [PATCH 0/5] FSI warning fixes Joel Stanley
2018-06-18  3:43 ` [PATCH 1/5] fsi-occ: Fix size_t printf Joel Stanley
2018-06-18  4:30   ` Benjamin Herrenschmidt
2018-06-18  3:43 ` [PATCH 2/5] hwmon (occ): Fix printf warning Joel Stanley
2018-06-18  3:43 ` [PATCH 3/5] fsi: sbefifo: Fix sparse warnings Joel Stanley
2018-06-18  3:43 ` [PATCH 4/5] fsi: master-hub: " Joel Stanley
2018-06-18  3:43 ` [PATCH 5/5] fsi: core: " Joel Stanley
2018-06-18  4:32 ` [PATCH 0/5] FSI warning fixes Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).