spi: checking for NULL instead of IS_ERR
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 12 Feb 2016 06:38:33 +0000 (09:38 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 12 Feb 2016 23:03:56 +0000 (23:03 +0000)
spi_replace_transfers() returns error pointers on error, it never
returns NULL.

Fixes: d9f121227281 ('spi: core: add spi_split_transfers_maxsize')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index 34e3741504f94389415f9c5e36b8a5ec7dae4ea1..801e8900898ba31aae7d3d32e562bd24837cce4f 100644 (file)
@@ -2262,8 +2262,8 @@ int __spi_split_transfer_maxsize(struct spi_master *master,
 
        /* create replacement */
        srt = spi_replace_transfers(msg, xfer, 1, count, NULL, 0, gfp);
-       if (!srt)
-               return -ENOMEM;
+       if (IS_ERR(srt))
+               return PTR_ERR(srt);
        xfers = srt->inserted_transfers;
 
        /* now handle each of those newly inserted spi_transfers