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]
Message-ID: <20200904122303.GC4625@sirena.org.uk>
Date:   Fri, 4 Sep 2020 13:23:03 +0100
From:   Mark Brown <broonie@...nel.org>
To:     Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
Cc:     linuxarm@...wei.com, mauro.chehab@...wei.com,
        John Stultz <john.stultz@...aro.org>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Robin Murphy <robin.murphy@....com>,
        Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC 09/10] misc: hisi_hikey_usb: add support for Hikey 970

On Fri, Sep 04, 2020 at 12:23:31PM +0200, Mauro Carvalho Chehab wrote:

> +	regulator = devm_regulator_get_optional(&pdev->dev, "hub-vdd");
> +	if (IS_ERR(regulator)) {
> +		if (PTR_ERR(regulator) == -EPROBE_DEFER) {
> +			dev_info(&pdev->dev,
> +				 "waiting for hub-vdd-supply to be probed\n");
> +			return PTR_ERR(regulator);
> +		}
> +
> +		/* let it fall back to regulator dummy */
> +		regulator = devm_regulator_get(&pdev->dev, "hub-vdd");
> +		if (IS_ERR(regulator)) {
> +			dev_err(&pdev->dev,
> +				"get hub-vdd-supply failed with error %ld\n",
> +				PTR_ERR(regulator));
> +			return PTR_ERR(regulator);
> +		}
> +	}

This seems weird - if the supply is non-optional why is the code trying
with devm_regulator_get_optional()?  Just use normal get directly.

> +	ret = regulator_set_voltage(regulator, 3300000, 3300000);
> +	if (ret)
> +		dev_err(&pdev->dev, "set hub-vdd-supply voltage failed\n");

Unless the device is actively managing the voltage at runtime it should
just let the voltage be set by machine constraints, most of the time
this will do nothing.  This only sets the voltage in this one place.

> +	hub_reset_en_gpio = of_get_named_gpio(pdev->dev.of_node,
> +					      "hub_reset_en_gpio", 0);
> +	if (!gpio_is_valid(hub_reset_en_gpio)) {
> +		dev_err(&pdev->dev, "Failed to get a valid reset gpio\n");
> +		return -ENODEV;
> +	}

Why not just use devm_gpio_request() which already asks for the GPIO by
name?

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