All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
To: Abhilash K V <abhilash.kv-l0cyMroinI0@public.gmane.org>
Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Vaibhav Hiremath <hvaibhav-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH] can : TI_HECC : Unintialized variables
Date: Thu, 10 Mar 2011 18:07:32 +0100	[thread overview]
Message-ID: <4D790554.20204@grandegger.com> (raw)
In-Reply-To: <1299774087-8532-1-git-send-email-abhilash.kv-l0cyMroinI0@public.gmane.org>

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-l0cyMroinI0@public.gmane.org>
> Acked-by: Anant Gole <anantgole-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Abhilash K V <abhilash.kv-l0cyMroinI0@public.gmane.org>
> ---
>  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.

WARNING: multiple messages have this Message-ID (diff)
From: Wolfgang Grandegger <wg@grandegger.com>
To: Abhilash K V <abhilash.kv@ti.com>
Cc: socketcan-core@lists.berlios.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	Vaibhav Hiremath <hvaibhav@ti.com>
Subject: Re: [PATCH] can : TI_HECC : Unintialized variables
Date: Thu, 10 Mar 2011 18:07:32 +0100	[thread overview]
Message-ID: <4D790554.20204@grandegger.com> (raw)
In-Reply-To: <1299774087-8532-1-git-send-email-abhilash.kv@ti.com>

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.

  parent reply	other threads:[~2011-03-10 17:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 16:21 [PATCH] can : TI_HECC : Unintialized variables Abhilash K V
     [not found] ` <1299774087-8532-1-git-send-email-abhilash.kv-l0cyMroinI0@public.gmane.org>
2011-03-10 17:07   ` Wolfgang Grandegger [this message]
2011-03-10 17:07     ` Wolfgang Grandegger

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=4D790554.20204@grandegger.com \
    --to=wg-5yr1bzd7o62+xt7jha+gda@public.gmane.org \
    --cc=abhilash.kv-l0cyMroinI0@public.gmane.org \
    --cc=hvaibhav-l0cyMroinI0@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
    /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 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.