* [PATCH] net: ieee802154: fix missing checks for regmap_update_bits
@ 2019-03-24 23:18 Kangjie Lu
2019-03-27 15:11 ` Mukesh Ojha
2019-03-27 17:15 ` Stefan Schmidt
0 siblings, 2 replies; 3+ messages in thread
From: Kangjie Lu @ 2019-03-24 23:18 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Xue Liu, Alexander Aring, Stefan Schmidt,
David S. Miller, linux-wpan, netdev, linux-kernel
regmap_update_bits could fail and deserves a check.
The patch adds the checks and if it fails, returns its error
code upstream.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/net/ieee802154/mcr20a.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
index c589f5ae75bb..8bb53ec8d9cf 100644
--- a/drivers/net/ieee802154/mcr20a.c
+++ b/drivers/net/ieee802154/mcr20a.c
@@ -533,6 +533,8 @@ mcr20a_start(struct ieee802154_hw *hw)
dev_dbg(printdev(lp), "no slotted operation\n");
ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
DAR_PHY_CTRL1_SLOTTED, 0x0);
+ if (ret < 0)
+ return ret;
/* enable irq */
enable_irq(lp->spi->irq);
@@ -540,11 +542,15 @@ mcr20a_start(struct ieee802154_hw *hw)
/* Unmask SEQ interrupt */
ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL2,
DAR_PHY_CTRL2_SEQMSK, 0x0);
+ if (ret < 0)
+ return ret;
/* Start the RX sequence */
dev_dbg(printdev(lp), "start the RX sequence\n");
ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
DAR_PHY_CTRL1_XCVSEQ_MASK, MCR20A_XCVSEQ_RX);
+ if (ret < 0)
+ return ret;
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ieee802154: fix missing checks for regmap_update_bits
2019-03-24 23:18 [PATCH] net: ieee802154: fix missing checks for regmap_update_bits Kangjie Lu
@ 2019-03-27 15:11 ` Mukesh Ojha
2019-03-27 17:15 ` Stefan Schmidt
1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2019-03-27 15:11 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Xue Liu, Alexander Aring, Stefan Schmidt,
David S. Miller, linux-wpan, netdev, linux-kernel
On 3/25/2019 4:48 AM, Kangjie Lu wrote:
> regmap_update_bits could fail and deserves a check.
>
> The patch adds the checks and if it fails, returns its error
> code upstream.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
-Mukesh
> ---
> drivers/net/ieee802154/mcr20a.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
> index c589f5ae75bb..8bb53ec8d9cf 100644
> --- a/drivers/net/ieee802154/mcr20a.c
> +++ b/drivers/net/ieee802154/mcr20a.c
> @@ -533,6 +533,8 @@ mcr20a_start(struct ieee802154_hw *hw)
> dev_dbg(printdev(lp), "no slotted operation\n");
> ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
> DAR_PHY_CTRL1_SLOTTED, 0x0);
> + if (ret < 0)
> + return ret;
>
> /* enable irq */
> enable_irq(lp->spi->irq);
> @@ -540,11 +542,15 @@ mcr20a_start(struct ieee802154_hw *hw)
> /* Unmask SEQ interrupt */
> ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL2,
> DAR_PHY_CTRL2_SEQMSK, 0x0);
> + if (ret < 0)
> + return ret;
>
> /* Start the RX sequence */
> dev_dbg(printdev(lp), "start the RX sequence\n");
> ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
> DAR_PHY_CTRL1_XCVSEQ_MASK, MCR20A_XCVSEQ_RX);
> + if (ret < 0)
> + return ret;
>
> return 0;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ieee802154: fix missing checks for regmap_update_bits
2019-03-24 23:18 [PATCH] net: ieee802154: fix missing checks for regmap_update_bits Kangjie Lu
2019-03-27 15:11 ` Mukesh Ojha
@ 2019-03-27 17:15 ` Stefan Schmidt
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Schmidt @ 2019-03-27 17:15 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Xue Liu, Alexander Aring, David S. Miller, linux-wpan,
netdev, linux-kernel
Hello.
On 25.03.19 08:18, Kangjie Lu wrote:
> regmap_update_bits could fail and deserves a check.
>
> The patch adds the checks and if it fails, returns its error
> code upstream.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/net/ieee802154/mcr20a.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
> index c589f5ae75bb..8bb53ec8d9cf 100644
> --- a/drivers/net/ieee802154/mcr20a.c
> +++ b/drivers/net/ieee802154/mcr20a.c
> @@ -533,6 +533,8 @@ mcr20a_start(struct ieee802154_hw *hw)
> dev_dbg(printdev(lp), "no slotted operation\n");
> ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
> DAR_PHY_CTRL1_SLOTTED, 0x0);
> + if (ret < 0)
> + return ret;
>
> /* enable irq */
> enable_irq(lp->spi->irq);
> @@ -540,11 +542,15 @@ mcr20a_start(struct ieee802154_hw *hw)
> /* Unmask SEQ interrupt */
> ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL2,
> DAR_PHY_CTRL2_SEQMSK, 0x0);
> + if (ret < 0)
> + return ret;
>
> /* Start the RX sequence */
> dev_dbg(printdev(lp), "start the RX sequence\n");
> ret = regmap_update_bits(lp->regmap_dar, DAR_PHY_CTRL1,
> DAR_PHY_CTRL1_XCVSEQ_MASK, MCR20A_XCVSEQ_RX);
> + if (ret < 0)
> + return ret;
>
> return 0;
> }
>
This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!
regards
Stefan Schmidt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-27 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-24 23:18 [PATCH] net: ieee802154: fix missing checks for regmap_update_bits Kangjie Lu
2019-03-27 15:11 ` Mukesh Ojha
2019-03-27 17:15 ` Stefan Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).