regmap: spi: Handle allocation failures gracefully
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 5 Feb 2013 14:14:32 +0000 (14:14 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 5 Feb 2013 14:14:32 +0000 (14:14 +0000)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/regmap-spi.c

index 913274b..4c506bd 100644 (file)
@@ -86,6 +86,8 @@ static struct regmap_async *regmap_spi_async_alloc(void)
        struct regmap_async_spi *async_spi;
 
        async_spi = kzalloc(sizeof(*async_spi), GFP_KERNEL);
+       if (!async_spi)
+               return NULL;
 
        return &async_spi->core;
 }