diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2016-04-08 13:28:42 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-13 22:36:28 -0400 |
commit | a6d37131c02f15463daa00e2f1da6824e8e00de2 (patch) | |
tree | 0b3a900478aa4e19e39f38c360c465cb01442c0e | |
parent | 60e19518d657018c4e25f0c20ca4f623536714b5 (diff) | |
download | blackbird-obmc-linux-a6d37131c02f15463daa00e2f1da6824e8e00de2.tar.gz blackbird-obmc-linux-a6d37131c02f15463daa00e2f1da6824e8e00de2.zip |
net: ethernet: renesas: ravb_main: 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>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/renesas/ravb_main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 087e14a3fba7..9e2a0bd8f5a8 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1691,6 +1691,9 @@ static int ravb_set_gti(struct net_device *ndev) rate = clk_get_rate(clk); clk_put(clk); + if (!rate) + return -EINVAL; + inc = 1000000000ULL << 20; do_div(inc, rate); |