* [PATCH] clk: Fix a missing check on regmap_bulk_read
@ 2018-12-24 19:00 Aditya Pakki
2019-01-09 18:55 ` Stephen Boyd
2019-01-09 21:22 ` Marek Vasut
0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2018-12-24 19:00 UTC (permalink / raw)
To: pakki001
Cc: kjlu, Marek Vasut, Michael Turquette, Stephen Boyd, linux-clk,
linux-kernel
Currently, vc5_pll_recalc_rate() may produce incorrect output when
regmap_bulk_read() fails. The fix checks the return value of the
latter function and returns 0 in case of failure.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/clk/clk-versaclock5.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
index decffb3826ec..cd76a893c594 100644
--- a/drivers/clk/clk-versaclock5.c
+++ b/drivers/clk/clk-versaclock5.c
@@ -413,7 +413,8 @@ static unsigned long vc5_pll_recalc_rate(struct clk_hw *hw,
u32 div_int, div_frc;
u8 fb[5];
- regmap_bulk_read(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5);
+ if (regmap_bulk_read(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5))
+ return 0;
div_int = (fb[0] << 4) | (fb[1] >> 4);
div_frc = (fb[2] << 16) | (fb[3] << 8) | fb[4];
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: Fix a missing check on regmap_bulk_read
2018-12-24 19:00 [PATCH] clk: Fix a missing check on regmap_bulk_read Aditya Pakki
@ 2019-01-09 18:55 ` Stephen Boyd
2019-01-09 21:22 ` Marek Vasut
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2019-01-09 18:55 UTC (permalink / raw)
To: pakki001; +Cc: kjlu, Marek Vasut, Michael Turquette, linux-clk, linux-kernel
Quoting Aditya Pakki (2018-12-24 11:00:32)
> Currently, vc5_pll_recalc_rate() may produce incorrect output when
> regmap_bulk_read() fails. The fix checks the return value of the
> latter function and returns 0 in case of failure.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/clk/clk-versaclock5.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
> index decffb3826ec..cd76a893c594 100644
> --- a/drivers/clk/clk-versaclock5.c
> +++ b/drivers/clk/clk-versaclock5.c
> @@ -413,7 +413,8 @@ static unsigned long vc5_pll_recalc_rate(struct clk_hw *hw,
> u32 div_int, div_frc;
> u8 fb[5];
>
> - regmap_bulk_read(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5);
> + if (regmap_bulk_read(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5))
> + return 0;
There are a bunch of other regmap_*() APIs in here that "could fail".
Why has this one been chosen but the other ones not?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: Fix a missing check on regmap_bulk_read
2018-12-24 19:00 [PATCH] clk: Fix a missing check on regmap_bulk_read Aditya Pakki
2019-01-09 18:55 ` Stephen Boyd
@ 2019-01-09 21:22 ` Marek Vasut
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2019-01-09 21:22 UTC (permalink / raw)
To: Aditya Pakki
Cc: kjlu, Michael Turquette, Stephen Boyd, linux-clk, linux-kernel
On 12/24/18 8:00 PM, Aditya Pakki wrote:
> Currently, vc5_pll_recalc_rate() may produce incorrect output when
> regmap_bulk_read() fails. The fix checks the return value of the
> latter function and returns 0 in case of failure.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/clk/clk-versaclock5.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
> index decffb3826ec..cd76a893c594 100644
> --- a/drivers/clk/clk-versaclock5.c
> +++ b/drivers/clk/clk-versaclock5.c
> @@ -413,7 +413,8 @@ static unsigned long vc5_pll_recalc_rate(struct clk_hw *hw,
> u32 div_int, div_frc;
> u8 fb[5];
>
> - regmap_bulk_read(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5);
> + if (regmap_bulk_read(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5))
> + return 0;
Shouldn't this return ret on failure ?
> div_int = (fb[0] << 4) | (fb[1] >> 4);
> div_frc = (fb[2] << 16) | (fb[3] << 8) | fb[4];
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-09 21:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-24 19:00 [PATCH] clk: Fix a missing check on regmap_bulk_read Aditya Pakki
2019-01-09 18:55 ` Stephen Boyd
2019-01-09 21:22 ` Marek Vasut
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).