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] [day] [month] [year] [list]
Date:	Mon, 16 Jan 2012 19:33:09 +0000
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Thomas Abraham <thomas.abraham@...aro.org>
Cc:	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	rpurdie@...ys.net, linux-samsung-soc@...r.kernel.org,
	grant.likely@...retlab.ca, rob.herring@...xeda.com,
	kgene.kim@...sung.com, jg1.han@...sung.com,
	kyungmin.park@...sung.com, cbou@...l.ru, kwangwoo.lee@...il.com,
	augulis.darius@...il.com, ben-linux@...ff.org, lars@...afoo.de,
	patches@...aro.org
Subject: Re: [PATCH v2 1/2] backlight: lcd: add driver for raster-type lcd's
 with gpio controlled panel reset

On Thu, Jan 12, 2012 at 01:13:30PM +0530, Thomas Abraham wrote:

> +			/* set regulator voltage if specified */
> +			if (pd->min_uV || pd->max_uV)
> +				if (regulator_set_voltage(lp->regulator,
> +						pd->min_uV, pd->max_uV))
> +					dev_info(lp->dev,
> +						"voltage set failed\n");
> +			if (regulator_enable(lp->regulator))
> +				dev_info(lp->dev, "regulator enable failed\n");

You should really pay more attention to the errors here, especially for
the enable - this function does return an error code so you could
usefully tell the caller about failures.

> +	/*
> +	 * If power to lcd and/or lcd interface is controlled using a regulator,
> +	 * get the handle to the regulator for later use during power switching.
> +	 */
> +	lp->regulator = regulator_get(dev, "vcc-lcd");
> +	if (IS_ERR(lp->regulator))
> +		dev_info(dev, "could not find regulator\n");

It's much better style to assume that there will be a regulator in the
code and let the core worry about stubbing it out.  Given that you don't
offer any support for varying the voltage dynamically I'd suggest just
removing the set_voltage() support for now - if someone adds it they can
always add additional properties and worry about handling that situation
then.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ