Re: [patch] spi: bcm63xx-hsspi: checking for ERR_PTR instead of NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 6, 2013 at 1:58 PM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> devm_request_and_ioremap() returns NULL on error, it doesn't return an
> ERR_PTR().
>
> Fixes: 142168eba9dc ('spi: bcm63xx-hsspi: add bcm63xx HSSPI driver')
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
>
> diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
> index bc8d848d33b7..da9f85d55c81 100644
> --- a/drivers/spi/spi-bcm63xx-hsspi.c
> +++ b/drivers/spi/spi-bcm63xx-hsspi.c
> @@ -339,8 +339,8 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
>
>         res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         regs = devm_request_and_ioremap(dev, res_mem);
> -       if (IS_ERR(regs))
> -               return PTR_ERR(regs);
> +       if (!regs)
> +               return -EADDRNOTAVAIL;

Instead of fixing the wrong handling of the return value, let's change
it to use devm_ioremap_resource() which actually returns the expected
ERR_PTR() and is preferred over request_and_ioremap().


Regards
Jonas
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux