diff options
-rw-r--r-- | drivers/pwm/pwm-atmel-hlcdc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c index e7a785fadcdf..522f7075bb1a 100644 --- a/drivers/pwm/pwm-atmel-hlcdc.c +++ b/drivers/pwm/pwm-atmel-hlcdc.c | |||
@@ -64,6 +64,9 @@ static int atmel_hlcdc_pwm_config(struct pwm_chip *c, | |||
64 | 64 | ||
65 | if (!chip->errata || !chip->errata->slow_clk_erratum) { | 65 | if (!chip->errata || !chip->errata->slow_clk_erratum) { |
66 | clk_freq = clk_get_rate(new_clk); | 66 | clk_freq = clk_get_rate(new_clk); |
67 | if (!clk_freq) | ||
68 | return -EINVAL; | ||
69 | |||
67 | clk_period_ns = (u64)NSEC_PER_SEC * 256; | 70 | clk_period_ns = (u64)NSEC_PER_SEC * 256; |
68 | do_div(clk_period_ns, clk_freq); | 71 | do_div(clk_period_ns, clk_freq); |
69 | } | 72 | } |
@@ -73,6 +76,9 @@ static int atmel_hlcdc_pwm_config(struct pwm_chip *c, | |||
73 | clk_period_ns > period_ns) { | 76 | clk_period_ns > period_ns) { |
74 | new_clk = hlcdc->sys_clk; | 77 | new_clk = hlcdc->sys_clk; |
75 | clk_freq = clk_get_rate(new_clk); | 78 | clk_freq = clk_get_rate(new_clk); |
79 | if (!clk_freq) | ||
80 | return -EINVAL; | ||
81 | |||
76 | clk_period_ns = (u64)NSEC_PER_SEC * 256; | 82 | clk_period_ns = (u64)NSEC_PER_SEC * 256; |
77 | do_div(clk_period_ns, clk_freq); | 83 | do_div(clk_period_ns, clk_freq); |
78 | } | 84 | } |