* [PATCH] can : TI_HECC : Unintialized variables
@ 2011-03-10 16:21 Abhilash K V
2011-03-10 17:07 ` Wolfgang Grandegger
0 siblings, 1 reply; 2+ messages in thread
From: Abhilash K V @ 2011-03-10 16:21 UTC (permalink / raw)
To: socketcan-core, netdev, linux-kernel
Cc: wg, linux-omap, Abhilash K V, Vaibhav Hiremath
1. In ti_hecc_xmit(), "data" is not initialized, causing
undesirable effects like setting the RTR field for every
transmit.
2. In ti_hecc_probe(), the spinlock priv->mbx_lock is not
inited, causing a spinlock lockup BUG.
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Acked-by: Anant Gole <anantgole@ti.com>
Signed-off-by: Abhilash K V <abhilash.kv@ti.com>
---
drivers/net/can/ti_hecc.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 4d07f1e..73c6025 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -503,6 +503,7 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev)
spin_unlock_irqrestore(&priv->mbx_lock, flags);
/* Prepare mailbox for transmission */
+ data = cf->can_dlc;
if (cf->can_id & CAN_RTR_FLAG) /* Remote transmission request */
data |= HECC_CANMCF_RTR;
data |= get_tx_head_prio(priv) << 8;
@@ -923,6 +924,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
priv->can.do_get_state = ti_hecc_get_state;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
+ spin_lock_init(&priv->mbx_lock);
ndev->irq = irq->start;
ndev->flags |= IFF_ECHO;
platform_set_drvdata(pdev, ndev);
--
1.6.2.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] can : TI_HECC : Unintialized variables
2011-03-10 16:21 [PATCH] can : TI_HECC : Unintialized variables Abhilash K V
@ 2011-03-10 17:07 ` Wolfgang Grandegger
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Grandegger @ 2011-03-10 17:07 UTC (permalink / raw)
To: Abhilash K V
Cc: socketcan-core, netdev, linux-kernel, linux-omap,
Vaibhav Hiremath
On 03/10/2011 05:21 PM, Abhilash K V wrote:
> 1. In ti_hecc_xmit(), "data" is not initialized, causing
> undesirable effects like setting the RTR field for every
> transmit.
Does it need to be initialized to "data = cf->can_dlc"? If yes, please
correct the message, if not ...
> 2. In ti_hecc_probe(), the spinlock priv->mbx_lock is not
> inited, causing a spinlock lockup BUG.
>
> Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
> Acked-by: Anant Gole <anantgole@ti.com>
> Signed-off-by: Abhilash K V <abhilash.kv@ti.com>
> ---
> drivers/net/can/ti_hecc.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
> index 4d07f1e..73c6025 100644
> --- a/drivers/net/can/ti_hecc.c
> +++ b/drivers/net/can/ti_hecc.c
> @@ -503,6 +503,7 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev)
> spin_unlock_irqrestore(&priv->mbx_lock, flags);
>
> /* Prepare mailbox for transmission */
> + data = cf->can_dlc;
> if (cf->can_id & CAN_RTR_FLAG) /* Remote transmission request */
> data |= HECC_CANMCF_RTR;
> data |= get_tx_head_prio(priv) << 8;
... using the following expressions looks more reasonable:
data = get_tx_head_prio(priv) << 8;
if (cf->can_id & CAN_RTR_FLAG) /* Remote transmission request */
data |= HECC_CANMCF_RTR;
Wolfgang.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-10 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-10 16:21 [PATCH] can : TI_HECC : Unintialized variables Abhilash K V
2011-03-10 17:07 ` Wolfgang Grandegger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox