]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/pwm/pwm-sun4i.c
scsi: ufs: Unlock on a couple error paths
[linux.git] / drivers / pwm / pwm-sun4i.c
index 6f5840a1a82dc1909aad7e6d61632aea8a7b8271..581d2328733318e8f396e6675bed54a777279bdd 100644 (file)
@@ -137,10 +137,10 @@ static void sun4i_pwm_get_state(struct pwm_chip *chip,
 
        val = sun4i_pwm_readl(sun4i_pwm, PWM_CH_PRD(pwm->hwpwm));
 
-       tmp = prescaler * NSEC_PER_SEC * PWM_REG_DTY(val);
+       tmp = (u64)prescaler * NSEC_PER_SEC * PWM_REG_DTY(val);
        state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, clk_rate);
 
-       tmp = prescaler * NSEC_PER_SEC * PWM_REG_PRD(val);
+       tmp = (u64)prescaler * NSEC_PER_SEC * PWM_REG_PRD(val);
        state->period = DIV_ROUND_CLOSEST_ULL(tmp, clk_rate);
 }
 
@@ -156,7 +156,6 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip *sun4i_pwm,
        if (sun4i_pwm->data->has_prescaler_bypass) {
                /* First, test without any prescaler when available */
                prescaler = PWM_PRESCAL_MASK;
-               pval = 1;
                /*
                 * When not using any prescaler, the clock period in nanoseconds
                 * is not an integer so round it half up instead of