netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] qed*: Fix the static checker warnings.
@ 2016-06-28  6:10 Sudarsana Reddy Kalluru
  2016-06-28  6:10 ` [PATCH net-next 1/2] qed: Fix " Sudarsana Reddy Kalluru
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sudarsana Reddy Kalluru @ 2016-06-28  6:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Yuval.Mintz, sudarsana.kalluru

The patch series addresses the static checker warnings introduced by the
earlier patches related to qed/qede coalesce configuration support.

Sudarsana Reddy Kalluru (2):
  qed: Fix static checker warnings.
  qede: Fix the static checker warnings.

 drivers/net/ethernet/qlogic/qed/qed.h           | 4 ++--
 drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
1.8.3.1

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

* [PATCH net-next 1/2] qed: Fix static checker warnings.
  2016-06-28  6:10 [PATCH net-next 0/2] qed*: Fix the static checker warnings Sudarsana Reddy Kalluru
@ 2016-06-28  6:10 ` Sudarsana Reddy Kalluru
  2016-06-28  6:10 ` [PATCH net-next 2/2] qede: Fix the " Sudarsana Reddy Kalluru
  2016-06-29 11:59 ` [PATCH net-next 0/2] qed*: " David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Sudarsana Reddy Kalluru @ 2016-06-28  6:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Yuval.Mintz, sudarsana.kalluru

Static checker warnings:
drivers/net/ethernet/qlogic/qed/qed_int.c:2450 qed_init_cau_sb_entry()
warn: always true condition '(cdev->rx_coalesce_usecs <= 255) =>
(0-255 <= 255)'
drivers/net/ethernet/qlogic/qed/qed_int.c:2511 qed_int_cau_conf_sb()
warn: always true condition '(p_hwfn->cdev->rx_coalesce_usecs <= 255)
=> (0-255 <= 255)'
..

The data types for rx/tx_coalesce_usecs should be u16.

Fixes: commit 722003ac40c2 ("qed: Add support for coalescing config read/update.")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
---
 drivers/net/ethernet/qlogic/qed/qed.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed.h b/drivers/net/ethernet/qlogic/qed/qed.h
index 9a63df1..35e5377 100644
--- a/drivers/net/ethernet/qlogic/qed/qed.h
+++ b/drivers/net/ethernet/qlogic/qed/qed.h
@@ -489,8 +489,8 @@ struct qed_dev {
 
 	u32				int_mode;
 	enum qed_coalescing_mode	int_coalescing_mode;
-	u8				rx_coalesce_usecs;
-	u8				tx_coalesce_usecs;
+	u16				rx_coalesce_usecs;
+	u16				tx_coalesce_usecs;
 
 	/* Start Bar offset of first hwfn */
 	void __iomem			*regview;
-- 
1.8.3.1

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

* [PATCH net-next 2/2] qede: Fix the static checker warnings.
  2016-06-28  6:10 [PATCH net-next 0/2] qed*: Fix the static checker warnings Sudarsana Reddy Kalluru
  2016-06-28  6:10 ` [PATCH net-next 1/2] qed: Fix " Sudarsana Reddy Kalluru
@ 2016-06-28  6:10 ` Sudarsana Reddy Kalluru
  2016-06-29 11:59 ` [PATCH net-next 0/2] qed*: " David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Sudarsana Reddy Kalluru @ 2016-06-28  6:10 UTC (permalink / raw)
  To: davem; +Cc: netdev, Yuval.Mintz, sudarsana.kalluru

Static checker warnings:
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:435 qede_get_coalesce()
warn: passing casted pointer '&coal->rx_coalesce_usecs' to
'edev->ops->common->get_coalesce()' 32 vs 16.

The u32 pointer is being typecasted to u16 which may fail for big-endian
platforms.

Fixes: d552fa84cb35 ("qede: Add support for coalescing config read/update.")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
---
 drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
index 6228482..c5c658a 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
@@ -430,11 +430,13 @@ static int qede_get_coalesce(struct net_device *dev,
 			     struct ethtool_coalesce *coal)
 {
 	struct qede_dev *edev = netdev_priv(dev);
+	u16 rxc, txc;
 
 	memset(coal, 0, sizeof(struct ethtool_coalesce));
-	edev->ops->common->get_coalesce(edev->cdev,
-					(u16 *)&coal->rx_coalesce_usecs,
-					(u16 *)&coal->tx_coalesce_usecs);
+	edev->ops->common->get_coalesce(edev->cdev, &rxc, &txc);
+
+	coal->rx_coalesce_usecs = rxc;
+	coal->tx_coalesce_usecs = txc;
 
 	return 0;
 }
-- 
1.8.3.1

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

* Re: [PATCH net-next 0/2] qed*: Fix the static checker warnings.
  2016-06-28  6:10 [PATCH net-next 0/2] qed*: Fix the static checker warnings Sudarsana Reddy Kalluru
  2016-06-28  6:10 ` [PATCH net-next 1/2] qed: Fix " Sudarsana Reddy Kalluru
  2016-06-28  6:10 ` [PATCH net-next 2/2] qede: Fix the " Sudarsana Reddy Kalluru
@ 2016-06-29 11:59 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-06-29 11:59 UTC (permalink / raw)
  To: sudarsana.kalluru; +Cc: netdev, Yuval.Mintz

From: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com>
Date: Tue, 28 Jun 2016 02:10:57 -0400

> The patch series addresses the static checker warnings introduced by the
> earlier patches related to qed/qede coalesce configuration support.

Series applied.

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

end of thread, other threads:[~2016-06-29 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-28  6:10 [PATCH net-next 0/2] qed*: Fix the static checker warnings Sudarsana Reddy Kalluru
2016-06-28  6:10 ` [PATCH net-next 1/2] qed: Fix " Sudarsana Reddy Kalluru
2016-06-28  6:10 ` [PATCH net-next 2/2] qede: Fix the " Sudarsana Reddy Kalluru
2016-06-29 11:59 ` [PATCH net-next 0/2] qed*: " David Miller

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).