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: <20230119093450.GA14049@pengutronix.de>
Date:   Thu, 19 Jan 2023 10:34:50 +0100
From:   Philipp Zabel <p.zabel@...gutronix.de>
To:     Brad Larson <blarson@....com>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-mmc@...r.kernel.org, linux-spi@...r.kernel.org,
        adrian.hunter@...el.com, alcooperx@...il.com,
        andy.shevchenko@...il.com, arnd@...db.de, brad@...sando.io,
        brendan.higgins@...ux.dev, briannorris@...omium.org,
        brijeshkumar.singh@....com, catalin.marinas@....com,
        davidgow@...gle.com, gsomlo@...il.com, gerg@...ux-m68k.org,
        krzk@...nel.org, krzysztof.kozlowski+dt@...aro.org, lee@...nel.org,
        lee.jones@...aro.org, broonie@...nel.org,
        yamada.masahiro@...ionext.com, piotrs@...ence.com, p.yadav@...com,
        rdunlap@...radead.org, robh+dt@...nel.org, samuel@...lland.org,
        fancer.lancer@...il.com, skhan@...uxfoundation.org,
        suravee.suthikulpanit@....com, thomas.lendacky@....com,
        tonyhuang.sunplus@...il.com, ulf.hansson@...aro.org,
        vaishnav.a@...com, will@...nel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v9 14/15] mmc: sdhci-cadence: Support mmc hardware reset

Hi Brad,

On Wed, Jan 18, 2023 at 07:51:35PM -0800, Brad Larson wrote:
> Add support for mmc hardware reset using a reset-controller
> that would need to be enabled in the device tree with
> a supporting driver.  The default is disabled for all
> existing designs.
> 
> Signed-off-by: Brad Larson <blarson@....com>
> ---
> 
> Changes since v6:
> - Previously patch 17/17
> - Changed delay after reset_control_assert() from 9 to 3 usec
> - Renamed sdhci_mmc_hw_reset() to sdhci_cdns_mmc_hw_reset()
> 
> ---
>  drivers/mmc/host/sdhci-cadence.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
> index e92aa79a8be2..62321cef41db 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -12,6 +12,7 @@
[...]
>  static int sdhci_cdns_probe(struct platform_device *pdev)
>  {
>  	struct sdhci_host *host;
> @@ -521,6 +541,17 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto free;
>  
> +	if (host->mmc->caps & MMC_CAP_HW_RESET) {
> +		priv->rst_hw = devm_reset_control_get_optional_exclusive(dev, "hw");
> +		if (IS_ERR(priv->rst_hw)) {
> +			ret = PTR_ERR(priv->rst_hw);
> +			if (ret == -ENOENT)
> +				priv->rst_hw = NULL;

The optional reset_control_get variants return NULL instead of -ENOENT
if no reset is specified.

This should return on any error instead.

> +		} else {
> +			host->mmc_host_ops.card_hw_reset = sdhci_cdns_mmc_hw_reset;

This probably shouldn't be set if reset_control_get_optional returned NULL.

> +		}
> +	}
> +
>  	ret = sdhci_add_host(host);

regards
Philipp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ