[prev in list] [next in list] [prev in thread] [next in thread]
List: git-commits-head
Subject: ide: palm_bk3710: test clock rate to avoid division by 0
From: "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date: 2016-03-28 20:20:19
Message-ID: 20160328202019.F058C660F93 () gitolite ! kernel ! org
[Download RAW message or body]
Web: https://git.kernel.org/torvalds/c/0d7ef45cdeebcc95d581703f45f6de7b2ee89b8d
Commit: 0d7ef45cdeebcc95d581703f45f6de7b2ee89b8d
Parent: eccf432f6542d9895d6c50edb5634c6147918ed2
Refname: refs/heads/master
Author: Wolfram Sang <wsa+renesas@sang-engineering.com>
AuthorDate: Wed Mar 2 23:33:32 2016 +0100
Committer: David S. Miller <davem@davemloft.net>
CommitDate: Sun Mar 20 16:59:27 2016 -0400
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>
---
drivers/ide/palm_bk3710.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c
index 8012e43..46427ea 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;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic