diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2016-03-02 23:33:32 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-20 21:59:27 +0100 |
commit | 0d7ef45cdeebcc95d581703f45f6de7b2ee89b8d (patch) | |
tree | f79b4359d7bc5cccb5c468ad482d88eb64eeb4e0 /drivers/ide | |
parent | ide: icside: remove incorrect initconst annotation (diff) | |
download | linux-0d7ef45cdeebcc95d581703f45f6de7b2ee89b8d.tar.xz linux-0d7ef45cdeebcc95d581703f45f6de7b2ee89b8d.zip |
ide: palm_bk3710: test clock rate to avoid division by 0
The clk API may return 0 on clk_get_rate, so we should check the result before
using it as a divisor.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/palm_bk3710.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c index 8012e43bf8f6..46427ea01753 100644 --- a/drivers/ide/palm_bk3710.c +++ b/drivers/ide/palm_bk3710.c @@ -325,6 +325,8 @@ static int __init palm_bk3710_probe(struct platform_device *pdev) clk_enable(clk); rate = clk_get_rate(clk); + if (!rate) + return -EINVAL; /* NOTE: round *down* to meet minimum timings; we count in clocks */ ideclk_period = 1000000000UL / rate; |