Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1382416

Re: [PATCH 1/7] mmc: sdhci-pltfm: bail out if register resource is too small

From Adrian Hunter <adrian.hunter@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/7] mmc: sdhci-pltfm: bail out if register resource is too small
Date 2016-04-19 13:40 +0200
Message-ID <rpCaC-6a2-21@gated-at.bofh.it> (permalink)
References <rnFcB-2RY-5@gated-at.bofh.it> <rnFmh-2VI-7@gated-at.bofh.it>
Organization Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki

Show all headers | View raw


On 14/04/16 05:29, Masahiro Yamada wrote:
> This code checks the resource size and displays an error message if
> it is too small, but still moves forward.  Let is fail in that case.

is -> it

How do you know there aren't drivers that actually have a smaller size?

One that might not is sdhci-dove which appears to sidestep some registers in
sdhci_dove_readw().


> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/mmc/host/sdhci-pltfm.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 072bb27..7d12203 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -127,8 +127,11 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  		goto err;
>  	}
>  
> -	if (resource_size(iomem) < 0x100)
> +	if (resource_size(iomem) < 0x100) {
>  		dev_err(&pdev->dev, "Invalid iomem size!\n");
> +		ret = -EINVAL;
> +		goto err;
> +	}
>  
>  	host = sdhci_alloc_host(&pdev->dev,
>  		sizeof(struct sdhci_pltfm_host) + priv_size);
> 

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/7] mmc: sdhci-pltfm: bail out if register resource is  too small Adrian Hunter <adrian.hunter@intel.com> - 2016-04-19 13:40 +0200
  Re: [PATCH 1/7] mmc: sdhci-pltfm: bail out if register resource is  too small Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-04-19 13:50 +0200
    Re: [PATCH 1/7] mmc: sdhci-pltfm: bail out if register resource is  too small Adrian Hunter <adrian.hunter@intel.com> - 2016-04-19 15:40 +0200

csiph-web