lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 31 Jul 2020 21:47:16 +0200
From:   Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To:     Rahul Tanwar <rahul.tanwar@...ux.intel.com>
Cc:     linux-pwm@...r.kernel.org, lee.jones@...aro.org,
        thierry.reding@...il.com, p.zabel@...gutronix.de,
        robh+dt@...nel.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, andriy.shevchenko@...el.com,
        songjun.Wu@...el.com, cheol.yong.kim@...el.com,
        qi-ming.wu@...el.com, rahul.tanwar.linux@...il.com
Subject: Re: [PATCH v6 2/2] Add PWM fan controller driver for LGM SoC

Hello,

I only found a two minor issues this round, see below.

On Tue, Jul 28, 2020 at 04:52:13PM +0800, Rahul Tanwar wrote:
> +static int lgm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> +			 const struct pwm_state *state)
> +{
> +	struct lgm_pwm_chip *pc = to_lgm_pwm_chip(chip);
> +	u32 duty_cycle, val;
> +	int ret;
> +
> +	/*
> +	 * HW only supports only NORMAL polarity
> +	 * HW supports fixed period

there are too many "only"s here. What about:

	/*
	 * The hardware only supports
	 * normal polarity and fixed period.
	 */

?

> +	 */
> +	if (state->polarity != PWM_POLARITY_NORMAL ||
> +	    state->period < pc->period)
> +		return -EINVAL;
> +
> +	if (!state->enabled) {
> +		ret = lgm_pwm_enable(chip, 0);
> +		return ret;
> +	}
> +
> +	duty_cycle = min_t(u64, state->duty_cycle, pc->period);
> +	val = duty_cycle * LGM_PWM_MAX_DUTY_CYCLE / pc->period;
> +
> +	ret = regmap_update_bits(pc->regmap, LGM_PWM_FAN_CON0, LGM_PWM_FAN_DC_MSK,
> +				 FIELD_PREP(LGM_PWM_FAN_DC_MSK, val));
> +	if (ret)
> +		return ret;
> +
> +	if (state->enabled)
> +		ret = lgm_pwm_enable(chip, 1);

You can do this unconditionally, if state->enabled is false the function
returns a few lines above already.

> +
> +	return ret;
> +}

The rest looks fine.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ