Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Varka Bhadram <varkabhadram@gmail.com>
To: Stefan Schmidt <stefan@osg.samsung.com>, linux-wpan@vger.kernel.org
Cc: Alexander Aring <alex.aring@gmail.com>
Subject: Re: [PATCH bluetooth-next] ieee802154/cc2520: check for return values in cc2520_filter()
Date: Tue, 09 Jun 2015 14:51:16 +0530	[thread overview]
Message-ID: <5576B00C.6020003@gmail.com> (raw)
In-Reply-To: <1433841108-1122-1-git-send-email-stefan@osg.samsung.com>

Hi Stefan,

On 06/09/2015 02:41 PM, Stefan Schmidt wrote:

> neither ram nor register write return values have been checked here. Checking
> both now. Assign ret with 0 as all other assignments are inside if blocks and
> might not happen before we return ret.
>
> CID: 1230469
> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
> Cc: Varka Bhadram <varkabhadram@gmail.com>
> ---
>   drivers/net/ieee802154/cc2520.c | 21 +++++++++++----------
>   1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
> index 15f263c..54c15e0 100644
> --- a/drivers/net/ieee802154/cc2520.c
> +++ b/drivers/net/ieee802154/cc2520.c
> @@ -590,22 +590,23 @@ cc2520_filter(struct ieee802154_hw *hw,
>   	      struct ieee802154_hw_addr_filt *filt, unsigned long changed)
>   {
>   	struct cc2520_private *priv = hw->priv;
> +	int ret = 0;
>   
>   	if (changed & IEEE802154_AFILT_PANID_CHANGED) {
>   		u16 panid = le16_to_cpu(filt->pan_id);
>   
>   		dev_vdbg(&priv->spi->dev,
>   			 "cc2520_filter called for pan id\n");
> -		cc2520_write_ram(priv, CC2520RAM_PANID,
> -				 sizeof(panid), (u8 *)&panid);
> +		ret = cc2520_write_ram(priv, CC2520RAM_PANID,
> +				       sizeof(panid), (u8 *)&panid);
>   	}
>   
>   	if (changed & IEEE802154_AFILT_IEEEADDR_CHANGED) {
>   		dev_vdbg(&priv->spi->dev,
>   			 "cc2520_filter called for IEEE addr\n");
> -		cc2520_write_ram(priv, CC2520RAM_IEEEADDR,
> -				 sizeof(filt->ieee_addr),
> -				 (u8 *)&filt->ieee_addr);
> +		ret = cc2520_write_ram(priv, CC2520RAM_IEEEADDR,
> +				       sizeof(filt->ieee_addr),
> +				       (u8 *)&filt->ieee_addr);
>   	}
>   
>   	if (changed & IEEE802154_AFILT_SADDR_CHANGED) {
> @@ -613,20 +614,20 @@ cc2520_filter(struct ieee802154_hw *hw,
>   
>   		dev_vdbg(&priv->spi->dev,
>   			 "cc2520_filter called for saddr\n");
> -		cc2520_write_ram(priv, CC2520RAM_SHORTADDR,
> -				 sizeof(addr), (u8 *)&addr);
> +		ret = cc2520_write_ram(priv, CC2520RAM_SHORTADDR,
> +				       sizeof(addr), (u8 *)&addr);
>   	}
>   
>   	if (changed & IEEE802154_AFILT_PANC_CHANGED) {
>   		dev_vdbg(&priv->spi->dev,
>   			 "cc2520_filter called for panc change\n");
>   		if (filt->pan_coord)
> -			cc2520_write_register(priv, CC2520_FRMFILT0, 0x02);
> +			ret = cc2520_write_register(priv, CC2520_FRMFILT0, 0x02);
>   		else
> -			cc2520_write_register(priv, CC2520_FRMFILT0, 0x00);
> +			ret = cc2520_write_register(priv, CC2520_FRMFILT0, 0x00);
>   	}
>   
> -	return 0;
> +	return ret;
>   }
>   
>   static inline int cc2520_set_tx_power(struct cc2520_private *priv, s32 mbm)

Thanks for the patch.

I found two check patch warnings on this patch.

As Alex pointed on other thread that you should use commit message
like "subsytem: file:" or only "subsytem:" in the subject.
But not "subsytem/subsubsystem:"

Thanks.

-- 
Varka Bhadram


  reply	other threads:[~2015-06-09  9:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09  9:11 [PATCH bluetooth-next] ieee802154/cc2520: check for return values in cc2520_filter() Stefan Schmidt
2015-06-09  9:21 ` Varka Bhadram [this message]
2015-06-09  9:51   ` Stefan Schmidt
2015-06-09 10:02     ` Alexander Aring
2015-06-09 11:50       ` Stefan Schmidt

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=5576B00C.6020003@gmail.com \
    --to=varkabhadram@gmail.com \
    --cc=alex.aring@gmail.com \
    --cc=linux-wpan@vger.kernel.org \
    --cc=stefan@osg.samsung.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