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
From: 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)"
Signed-off-by: Srinivas Neeli <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
---
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
From: Srinivas Neeli <[email protected]>
Bit enlarging is observed for CANFD2.0 when brp is 1,
So change brp_min value to 2.
Signed-off-by: Srinivas Neeli <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
---
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
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 |