diff mbox

[13/14] ieee802154: cc2520: switch from BUG_ON() to WARN_ON() on problem

Message ID 20170922121405.31789-14-stefan@osg.samsung.com
State Accepted
Headers show

Commit Message

Stefan Schmidt Sept. 22, 2017, 12:14 p.m. UTC
The check is valid but it does not warrant to crash the kernel. A
WARN_ON() is good enough here.
Found by checkpatch.

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
---
 drivers/net/ieee802154/cc2520.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefan Schmidt Nov. 6, 2017, 3:32 p.m. UTC | #1
Hello.

On 22.09.2017 14:14, Stefan Schmidt wrote:
> The check is valid but it does not warrant to crash the kernel. A
> WARN_ON() is good enough here.
> Found by checkpatch.
> 
> Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
> ---
>  drivers/net/ieee802154/cc2520.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
> index 735b9f5f9754..0c89d3edf901 100644
> --- a/drivers/net/ieee802154/cc2520.c
> +++ b/drivers/net/ieee802154/cc2520.c
> @@ -517,7 +517,7 @@ cc2520_tx(struct ieee802154_hw *hw, struct sk_buff *skb)
>  	}
>  
>  	spin_lock_irqsave(&priv->lock, flags);
> -	BUG_ON(priv->is_tx);
> +	WARN_ON(priv->is_tx);
>  	priv->is_tx = 1;
>  	spin_unlock_irqrestore(&priv->lock, flags);
>  
> @@ -643,9 +643,9 @@ cc2520_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
>  
>  	dev_dbg(&priv->spi->dev, "trying to set channel\n");
>  
> -	BUG_ON(page != 0);
> -	BUG_ON(channel < CC2520_MINCHANNEL);
> -	BUG_ON(channel > CC2520_MAXCHANNEL);
> +	WARN_ON(page != 0);
> +	WARN_ON(channel < CC2520_MINCHANNEL);
> +	WARN_ON(channel > CC2520_MAXCHANNEL);
>  
>  	ret = cc2520_write_register(priv, CC2520_FREQCTRL,
>  				    11 + 5 * (channel - 11));
> 

This patch has been applied to the wpan-next tree and will be
part of the next pull request to net-next. Thanks!

regards
Stefan Schmidt
--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 735b9f5f9754..0c89d3edf901 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -517,7 +517,7 @@  cc2520_tx(struct ieee802154_hw *hw, struct sk_buff *skb)
 	}
 
 	spin_lock_irqsave(&priv->lock, flags);
-	BUG_ON(priv->is_tx);
+	WARN_ON(priv->is_tx);
 	priv->is_tx = 1;
 	spin_unlock_irqrestore(&priv->lock, flags);
 
@@ -643,9 +643,9 @@  cc2520_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
 
 	dev_dbg(&priv->spi->dev, "trying to set channel\n");
 
-	BUG_ON(page != 0);
-	BUG_ON(channel < CC2520_MINCHANNEL);
-	BUG_ON(channel > CC2520_MAXCHANNEL);
+	WARN_ON(page != 0);
+	WARN_ON(channel < CC2520_MINCHANNEL);
+	WARN_ON(channel > CC2520_MAXCHANNEL);
 
 	ret = cc2520_write_register(priv, CC2520_FREQCTRL,
 				    11 + 5 * (channel - 11));