A couple of sparse warnings.

On Fri, Feb 19, 2016 at 11:15:31PM +0200, Roger Quadros wrote:
> Move NAND specific device tree parsing to NAND driver.
> 
> The NAND controller node must have a compatible id, register space
> resource and interrupt resource.
> 
> Signed-off-by: Roger Quadros <rog...@ti.com>
> ---
>  arch/arm/mach-omap2/gpmc-nand.c              |   5 +-
>  drivers/memory/omap-gpmc.c                   | 143 
> +++++++--------------------
>  drivers/mtd/nand/omap2.c                     | 133 +++++++++++++++++++++----
>  include/linux/platform_data/mtd-nand-omap2.h |   3 +-
>  4 files changed, 152 insertions(+), 132 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
> index 04e6998..f6ac027 100644
> --- a/arch/arm/mach-omap2/gpmc-nand.c
> +++ b/arch/arm/mach-omap2/gpmc-nand.c

[...]

> @@ -2039,9 +1939,42 @@ static int gpmc_probe_generic_child(struct 
> platform_device *pdev,
>               goto err;
>       }
>  
> -     ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width);
> -     if (ret < 0)
> -             goto err;
> +     if (of_node_cmp(child->name, "nand") == 0) {
> +             /* NAND specific setup */
> +             u32 val;

drivers/memory/omap-gpmc.c:1952:13: originally declared here [sparse]
drivers/memory/omap-gpmc.c:2029:21: warning: symbol 'val' shadows an earlier 
one [sparse]

> +
> +             /* Warn about older DT blobs with no compatible property */
> +             if (!of_property_read_bool(child, "compatible")) {
> +                     dev_warn(&pdev->dev,
> +                              "Incompatible NAND node: missing compatible");
> +                     ret = -EINVAL;
> +                     goto err;
> +             }
> +

[...]

> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index 9e99199..0a637c4 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c

[...]

> +static int omap_get_dt_info(struct device *dev, struct omap_nand_info *info)
> +{
> +     struct device_node *child = dev->of_node;
> +     int i;
> +     const char *s;
> +
> +     /* In old bindings, CS num is embedded in reg property */
> +     if (of_property_read_u32(child, "reg", &info->gpmc_cs) < 0) {

Sparse doesn't like this one:

drivers/mtd/nand/omap2.c:1660:49: warning: incorrect type in argument 3 
(different signedness) [sparse]
drivers/mtd/nand/omap2.c:1660:49:    expected unsigned int [usertype] 
*out_value [sparse]
drivers/mtd/nand/omap2.c:1660:49:    got int *<noident> [sparse]

> +             dev_err(dev, "reg not found in DT\n");
> +             return -EINVAL;
> +     }
> +

[...]

Brian 

Reply via email to