From: Michal Simek <michal.simek@xilinx.com>
To: linux-kernel@vger.kernel.org, monstr@monstr.eu,
michal.simek@xilinx.com, git@xilinx.com
Cc: Srinivas Neeli <srinivas.neeli@xilinx.com>,
Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>,
Wolfgang Grandegger <wg@grandegger.com>,
linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org,
netdev@vger.kernel.org
Subject: [PATCH 3/3] can: xilinx_can: Fix incorrect variable and initialize with a default value
Date: Mon, 14 Sep 2020 10:49:58 +0200 [thread overview]
Message-ID: <0651544d22f3c25893ca9d445b14823f0dfddfc8.1600073396.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <cover.1600073396.git.michal.simek@xilinx.com>
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
next prev parent reply other threads:[~2020-09-14 8:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-10-06 19:34 ` [PATCH 0/3] can: xilinx_can: Some minor changes Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0651544d22f3c25893ca9d445b14823f0dfddfc8.1600073396.git.michal.simek@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=appana.durga.rao@xilinx.com \
--cc=davem@davemloft.net \
--cc=git@xilinx.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=monstr@monstr.eu \
--cc=naga.sureshkumar.relli@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=srinivas.neeli@xilinx.com \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).