[PATCH] mtd: m25p80: Modify the name of mtd_info

Scott Wood scottwood at freescale.com
Fri Mar 21 13:34:56 EDT 2014


On Fri, 2014-03-21 at 19:16 +0800, Hou Zhiqiang wrote:
> @@ -1009,8 +1012,17 @@ static int m25p_probe(struct spi_device *spi)
>  
>  	if (data && data->name)
>  		flash->mtd.name = data->name;
> -	else
> -		flash->mtd.name = dev_name(&spi->dev);
> +	else{

Whitespace

> +		ret = of_address_to_resource(mnp, 0, &res);
> +		if (ret) {
> +			dev_err(&spi->dev, "failed to get spi master resource\n");
> +			return ret;
> +		}
> +		flash->mtd.name = kasprintf(GFP_KERNEL, "spi%x.%d",
> +				(unsigned)res.start, spi->chip_select);

Don't use "unsigned" by itself.  Don't cast physical addresses to
"unsigned int" -- use "unsigned long long".

-Scott





More information about the linux-mtd mailing list