can: xilinx_can: Some minor changes
Subsystems (5)
cover can: xilinx_can: Some minor changes
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(-)
Signature · 1 line
2.28.0
PATCH 2/3 can: xilinx_can: Check return value of set_reset_mode
From: Srinivas Neeli <[email protected]>
Check return value of set_reset_mode() for error.
Addresses-Coverity: "check_return"
---
drivers/net/can/xilinx_can.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/can/xilinx_can.c +5 -1
@@ -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 ; }
Signature · 1 line
2.28.0
PATCH 1/3 can: xilinx_can: Limit CANFD brp to 2
In reply to Michal SimekFrom: Srinivas Neeli <[email protected]>
Bit enlarging is observed for CANFD2.0 when brp is 1, So change brp_min value to 2.
---
drivers/net/can/xilinx_can.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/xilinx_can.c +2 -2
@@ -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, };
Signature · 1 line
2.28.0
PATCH 3/3 can: xilinx_can: Fix incorrect variable and initialize with a default value
In reply to Michal SimekFrom: Srinivas Neeli <[email protected]>
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)"
---
drivers/net/can/xilinx_can.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/xilinx_can.c +2 -2
@@ -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 ;
Signature · 1 line
2.28.0
Quoted 9 lines · Michal Simek
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
Quoted 5 lines
Srinivas Neeli (3):
can:xilinx_can: Limit CANFD brp to 2
can:xilinx_can: Check return value ofset_reset_mode
can:xilinx_can: Fix incorrect variable and initialize with a default
value
Applied to linux-can-next.
Tnx,
Marc
Signature · 4 lines
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 |