* [PATCH 1/2] net: can: remove unused variable
@ 2014-11-18 13:47 Sudip Mukherjee
2014-11-18 13:47 ` Sudip Mukherjee
2014-11-18 20:39 ` [PATCH 1/2] net: can: remove unused variable Marc Kleine-Budde
0 siblings, 2 replies; 7+ messages in thread
From: Sudip Mukherjee @ 2014-11-18 13:47 UTC (permalink / raw)
To: Wolfgang Grandegger, Marc Kleine-Budde
Cc: Sudip Mukherjee, linux-can, netdev, linux-kernel
these variable were only assigned some values, but then never
reused again.
so they are safe to be removed.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/net/can/sja1000/kvaser_pci.c | 5 +----
drivers/net/can/usb/ems_usb.c | 3 +--
drivers/net/can/usb/esd_usb2.c | 2 --
3 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c
index 8ff3424..15c00fa 100644
--- a/drivers/net/can/sja1000/kvaser_pci.c
+++ b/drivers/net/can/sja1000/kvaser_pci.c
@@ -214,7 +214,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
struct net_device *dev;
struct sja1000_priv *priv;
struct kvaser_pci *board;
- int err, init_step;
+ int err;
dev = alloc_sja1000dev(sizeof(struct kvaser_pci));
if (dev == NULL)
@@ -235,7 +235,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
if (channel == 0) {
board->xilinx_ver =
ioread8(board->res_addr + XILINX_VERINT) >> 4;
- init_step = 2;
/* Assert PTADR# - we're in passive mode so the other bits are
not important */
@@ -264,8 +263,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
priv->irq_flags = IRQF_SHARED;
dev->irq = pdev->irq;
- init_step = 4;
-
dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n",
priv->reg_base, board->conf_addr, dev->irq);
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 00f2534..29d3f09 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -434,10 +434,9 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
if (urb->actual_length > CPC_HEADER_SIZE) {
struct ems_cpc_msg *msg;
u8 *ibuf = urb->transfer_buffer;
- u8 msg_count, again, start;
+ u8 msg_count, start;
msg_count = ibuf[0] & ~0x80;
- again = ibuf[0] & 0x80;
start = CPC_HEADER_SIZE;
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index b7c9e8b..d25e88f 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -464,7 +464,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb)
{
struct esd_tx_urb_context *context = urb->context;
struct esd_usb2_net_priv *priv;
- struct esd_usb2 *dev;
struct net_device *netdev;
size_t size = sizeof(struct esd_usb2_msg);
@@ -472,7 +471,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb)
priv = context->priv;
netdev = priv->netdev;
- dev = priv->usb2;
/* free up our allocated buffer */
usb_free_coherent(urb->dev, size,
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] net: can: comparison of unsigned variable
2014-11-18 13:47 [PATCH 1/2] net: can: remove unused variable Sudip Mukherjee
@ 2014-11-18 13:47 ` Sudip Mukherjee
2014-11-18 20:39 ` [PATCH 1/2] net: can: remove unused variable Marc Kleine-Budde
1 sibling, 0 replies; 7+ messages in thread
From: Sudip Mukherjee @ 2014-11-18 13:47 UTC (permalink / raw)
To: Wolfgang Grandegger, Marc Kleine-Budde, Michal Simek,
Sören Brinkmann
Cc: Sudip Mukherjee, linux-can, netdev, linux-arm-kernel, linux-kernel
err was of the type u32. it was being compared with < 0, and being
an unsigned variable the comparison would have been always false.
moreover, err was getting the return value from set_reset_mode()
and xcan_set_bittiming(), and both are returning int.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/net/can/xilinx_can.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 72fe96f..67c2dd4 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev)
static int xcan_chip_start(struct net_device *ndev)
{
struct xcan_priv *priv = netdev_priv(ndev);
- u32 err, reg_msr, reg_sr_mask;
+ u32 reg_msr, reg_sr_mask;
+ int err;
unsigned long timeout;
/* Check if it is in reset mode */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] net: can: comparison of unsigned variable
@ 2014-11-18 13:47 ` Sudip Mukherjee
0 siblings, 0 replies; 7+ messages in thread
From: Sudip Mukherjee @ 2014-11-18 13:47 UTC (permalink / raw)
To: linux-arm-kernel
err was of the type u32. it was being compared with < 0, and being
an unsigned variable the comparison would have been always false.
moreover, err was getting the return value from set_reset_mode()
and xcan_set_bittiming(), and both are returning int.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/net/can/xilinx_can.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 72fe96f..67c2dd4 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev)
static int xcan_chip_start(struct net_device *ndev)
{
struct xcan_priv *priv = netdev_priv(ndev);
- u32 err, reg_msr, reg_sr_mask;
+ u32 reg_msr, reg_sr_mask;
+ int err;
unsigned long timeout;
/* Check if it is in reset mode */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] net: can: comparison of unsigned variable
2014-11-18 13:47 ` Sudip Mukherjee
(?)
@ 2014-11-18 16:47 ` Michal Simek
-1 siblings, 0 replies; 7+ messages in thread
From: Michal Simek @ 2014-11-18 16:47 UTC (permalink / raw)
To: Sudip Mukherjee, Wolfgang Grandegger, Marc Kleine-Budde,
Michal Simek, Sören Brinkmann
Cc: netdev, linux-kernel, linux-arm-kernel, linux-can
On 11/18/2014 02:47 PM, Sudip Mukherjee wrote:
> err was of the type u32. it was being compared with < 0, and being
> an unsigned variable the comparison would have been always false.
>
> moreover, err was getting the return value from set_reset_mode()
> and xcan_set_bittiming(), and both are returning int.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/net/can/xilinx_can.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> index 72fe96f..67c2dd4 100644
> --- a/drivers/net/can/xilinx_can.c
> +++ b/drivers/net/can/xilinx_can.c
> @@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev)
> static int xcan_chip_start(struct net_device *ndev)
> {
> struct xcan_priv *priv = netdev_priv(ndev);
> - u32 err, reg_msr, reg_sr_mask;
> + u32 reg_msr, reg_sr_mask;
> + int err;
> unsigned long timeout;
>
> /* Check if it is in reset mode */
>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] net: can: comparison of unsigned variable
@ 2014-11-18 16:47 ` Michal Simek
0 siblings, 0 replies; 7+ messages in thread
From: Michal Simek @ 2014-11-18 16:47 UTC (permalink / raw)
To: Sudip Mukherjee, Wolfgang Grandegger, Marc Kleine-Budde,
Michal Simek, Sören Brinkmann
Cc: linux-can, netdev, linux-arm-kernel, linux-kernel
On 11/18/2014 02:47 PM, Sudip Mukherjee wrote:
> err was of the type u32. it was being compared with < 0, and being
> an unsigned variable the comparison would have been always false.
>
> moreover, err was getting the return value from set_reset_mode()
> and xcan_set_bittiming(), and both are returning int.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/net/can/xilinx_can.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> index 72fe96f..67c2dd4 100644
> --- a/drivers/net/can/xilinx_can.c
> +++ b/drivers/net/can/xilinx_can.c
> @@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev)
> static int xcan_chip_start(struct net_device *ndev)
> {
> struct xcan_priv *priv = netdev_priv(ndev);
> - u32 err, reg_msr, reg_sr_mask;
> + u32 reg_msr, reg_sr_mask;
> + int err;
> unsigned long timeout;
>
> /* Check if it is in reset mode */
>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] net: can: comparison of unsigned variable
@ 2014-11-18 16:47 ` Michal Simek
0 siblings, 0 replies; 7+ messages in thread
From: Michal Simek @ 2014-11-18 16:47 UTC (permalink / raw)
To: linux-arm-kernel
On 11/18/2014 02:47 PM, Sudip Mukherjee wrote:
> err was of the type u32. it was being compared with < 0, and being
> an unsigned variable the comparison would have been always false.
>
> moreover, err was getting the return value from set_reset_mode()
> and xcan_set_bittiming(), and both are returning int.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/net/can/xilinx_can.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
> index 72fe96f..67c2dd4 100644
> --- a/drivers/net/can/xilinx_can.c
> +++ b/drivers/net/can/xilinx_can.c
> @@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev)
> static int xcan_chip_start(struct net_device *ndev)
> {
> struct xcan_priv *priv = netdev_priv(ndev);
> - u32 err, reg_msr, reg_sr_mask;
> + u32 reg_msr, reg_sr_mask;
> + int err;
> unsigned long timeout;
>
> /* Check if it is in reset mode */
>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: can: remove unused variable
2014-11-18 13:47 [PATCH 1/2] net: can: remove unused variable Sudip Mukherjee
2014-11-18 13:47 ` Sudip Mukherjee
@ 2014-11-18 20:39 ` Marc Kleine-Budde
1 sibling, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2014-11-18 20:39 UTC (permalink / raw)
To: Sudip Mukherjee, Wolfgang Grandegger; +Cc: linux-can, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 488 bytes --]
On 11/18/2014 02:47 PM, Sudip Mukherjee wrote:
> these variable were only assigned some values, but then never
> reused again.
> so they are safe to be removed.
Thanks, I've applied both patches.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-11-18 20:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-18 13:47 [PATCH 1/2] net: can: remove unused variable Sudip Mukherjee
2014-11-18 13:47 ` [PATCH 2/2] net: can: comparison of unsigned variable Sudip Mukherjee
2014-11-18 13:47 ` Sudip Mukherjee
2014-11-18 16:47 ` Michal Simek
2014-11-18 16:47 ` Michal Simek
2014-11-18 16:47 ` Michal Simek
2014-11-18 20:39 ` [PATCH 1/2] net: can: remove unused variable Marc Kleine-Budde
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.