linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] can: xilinx_can: Some minor changes
@ 2020-09-14  8:49 Michal Simek
  2020-09-14  8:49 ` [PATCH 1/3] can: xilinx_can: Limit CANFD brp to 2 Michal Simek
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michal Simek @ 2020-09-14  8:49 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Appana Durga Kedareswara rao, David S. Miller, Jakub Kicinski,
	Marc Kleine-Budde, Naga Sureshkumar Relli, Wolfgang Grandegger,
	linux-arm-kernel, linux-can, netdev

Hi,

recently some small patches come to our internal tree. We started to use
coverity which found 2 issues (last two patches) which is simply to fix.

Thanks,
Michal


Srinivas Neeli (3):
  can: xilinx_can: Limit CANFD brp to 2
  can: xilinx_can: Check return value of set_reset_mode
  can: xilinx_can: Fix incorrect variable and initialize with a default
    value

 drivers/net/can/xilinx_can.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

-- 
2.28.0


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

* [PATCH 1/3] can: xilinx_can: Limit CANFD brp to 2
  2020-09-14  8:49 [PATCH 0/3] can: xilinx_can: Some minor changes Michal Simek
@ 2020-09-14  8:49 ` Michal Simek
  2020-09-14  8:49 ` [PATCH 2/3] can: xilinx_can: Check return value of set_reset_mode Michal Simek
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2020-09-14  8:49 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Srinivas Neeli, Appana Durga Kedareswara rao, David S. Miller,
	Jakub Kicinski, Marc Kleine-Budde, Naga Sureshkumar Relli,
	Wolfgang Grandegger, linux-arm-kernel, linux-can, netdev

From: Srinivas Neeli <srinivas.neeli@xilinx.com>

Bit enlarging is observed for CANFD2.0 when brp is 1,
So change brp_min value to 2.

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/can/xilinx_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index c1dbab8c896d..f4b544b69646 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -259,7 +259,7 @@ static const struct can_bittiming_const xcan_bittiming_const_canfd2 = {
 	.tseg2_min = 1,
 	.tseg2_max = 128,
 	.sjw_max = 128,
-	.brp_min = 1,
+	.brp_min = 2,
 	.brp_max = 256,
 	.brp_inc = 1,
 };
@@ -272,7 +272,7 @@ static struct can_bittiming_const xcan_data_bittiming_const_canfd2 = {
 	.tseg2_min = 1,
 	.tseg2_max = 16,
 	.sjw_max = 16,
-	.brp_min = 1,
+	.brp_min = 2,
 	.brp_max = 256,
 	.brp_inc = 1,
 };
-- 
2.28.0


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

* [PATCH 2/3] can: xilinx_can: Check return value of set_reset_mode
  2020-09-14  8:49 [PATCH 0/3] can: xilinx_can: Some minor changes Michal Simek
  2020-09-14  8:49 ` [PATCH 1/3] can: xilinx_can: Limit CANFD brp to 2 Michal Simek
@ 2020-09-14  8:49 ` Michal Simek
  2020-09-14  8:49 ` [PATCH 3/3] can: xilinx_can: Fix incorrect variable and initialize with a default value Michal Simek
  2020-10-06 19:34 ` [PATCH 0/3] can: xilinx_can: Some minor changes Marc Kleine-Budde
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2020-09-14  8:49 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Srinivas Neeli, Appana Durga Kedareswara rao, David S. Miller,
	Jakub Kicinski, Marc Kleine-Budde, Naga Sureshkumar Relli,
	Wolfgang Grandegger, linux-arm-kernel, linux-can, netdev

From: Srinivas Neeli <srinivas.neeli@xilinx.com>

Check return value of set_reset_mode() for error.

Addresses-Coverity: "check_return"
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/can/xilinx_can.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index f4b544b69646..3393e2a73e15 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -1369,9 +1369,13 @@ static irqreturn_t xcan_interrupt(int irq, void *dev_id)
 static void xcan_chip_stop(struct net_device *ndev)
 {
 	struct xcan_priv *priv = netdev_priv(ndev);
+	int ret;
 
 	/* Disable interrupts and leave the can in configuration mode */
-	set_reset_mode(ndev);
+	ret = set_reset_mode(ndev);
+	if (ret < 0)
+		netdev_dbg(ndev, "set_reset_mode() Failed\n");
+
 	priv->can.state = CAN_STATE_STOPPED;
 }
 
-- 
2.28.0


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

* [PATCH 3/3] can: xilinx_can: Fix incorrect variable and initialize with a default value
  2020-09-14  8:49 [PATCH 0/3] can: xilinx_can: Some minor changes Michal Simek
  2020-09-14  8:49 ` [PATCH 1/3] can: xilinx_can: Limit CANFD brp to 2 Michal Simek
  2020-09-14  8:49 ` [PATCH 2/3] can: xilinx_can: Check return value of set_reset_mode Michal Simek
@ 2020-09-14  8:49 ` Michal Simek
  2020-10-06 19:34 ` [PATCH 0/3] can: xilinx_can: Some minor changes Marc Kleine-Budde
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2020-09-14  8:49 UTC (permalink / raw)
  To: linux-kernel, monstr, michal.simek, git
  Cc: Srinivas Neeli, Appana Durga Kedareswara rao, David S. Miller,
	Jakub Kicinski, Marc Kleine-Budde, Naga Sureshkumar Relli,
	Wolfgang Grandegger, linux-arm-kernel, linux-can, netdev

From: Srinivas Neeli <srinivas.neeli@xilinx.com>

Some variables with incorrect type were passed to "of_property_read_u32"
API, "of_property_read_u32" API was expecting an "u32 *" but the formal
parameter that was passed was of type "int *". Fixed the issue by
changing the variable types from "int" to "u32" and initialized with a
default value. Fixed sparse warning.

Addresses-Coverity: "incompatible_param"
Addresses-Coverity: "UNINIT(Using uninitialized value)"
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/net/can/xilinx_can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 3393e2a73e15..46c04b6390f8 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -1671,7 +1671,7 @@ static int xcan_probe(struct platform_device *pdev)
 	void __iomem *addr;
 	int ret;
 	int rx_max, tx_max;
-	int hw_tx_max, hw_rx_max;
+	u32 hw_tx_max = 0, hw_rx_max = 0;
 	const char *hw_tx_max_property;
 
 	/* Get the virtual base address for the device */
@@ -1724,7 +1724,7 @@ static int xcan_probe(struct platform_device *pdev)
 	 */
 	if (!(devtype->flags & XCAN_FLAG_TX_MAILBOXES) &&
 	    (devtype->flags & XCAN_FLAG_TXFEMP))
-		tx_max = min(hw_tx_max, 2);
+		tx_max = min(hw_tx_max, 2U);
 	else
 		tx_max = 1;
 
-- 
2.28.0


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

* Re: [PATCH 0/3] can: xilinx_can: Some minor changes
  2020-09-14  8:49 [PATCH 0/3] can: xilinx_can: Some minor changes Michal Simek
                   ` (2 preceding siblings ...)
  2020-09-14  8:49 ` [PATCH 3/3] can: xilinx_can: Fix incorrect variable and initialize with a default value Michal Simek
@ 2020-10-06 19:34 ` Marc Kleine-Budde
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2020-10-06 19:34 UTC (permalink / raw)
  To: Michal Simek, linux-kernel, monstr, git
  Cc: Appana Durga Kedareswara rao, David S. Miller, Jakub Kicinski,
	Naga Sureshkumar Relli, Wolfgang Grandegger, linux-arm-kernel,
	linux-can, netdev


[-- Attachment #1.1: Type: text/plain, Size: 768 bytes --]

On 9/14/20 10:49 AM, Michal Simek wrote:
> Hi,
> 
> recently some small patches come to our internal tree. We started to use
> coverity which found 2 issues (last two patches) which is simply to fix.
> 
> Thanks,
> Michal
> 
> 
> Srinivas Neeli (3):
>   can: xilinx_can: Limit CANFD brp to 2
>   can: xilinx_can: Check return value of set_reset_mode
>   can: xilinx_can: Fix incorrect variable and initialize with a default
>     value

Applied to linux-can-next.

Tnx,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-10-06 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  8:49 [PATCH 0/3] can: xilinx_can: Some minor changes Michal Simek
2020-09-14  8:49 ` [PATCH 1/3] can: xilinx_can: Limit CANFD brp to 2 Michal Simek
2020-09-14  8:49 ` [PATCH 2/3] can: xilinx_can: Check return value of set_reset_mode Michal Simek
2020-09-14  8:49 ` [PATCH 3/3] can: xilinx_can: Fix incorrect variable and initialize with a default value Michal Simek
2020-10-06 19:34 ` [PATCH 0/3] can: xilinx_can: Some minor changes Marc Kleine-Budde

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