Return -ENOMEM if the allocation fails. Don't return success. Fixes: 6598b91b5ac3 ("spi: spi.c: Convert statistics to per-cpu u64_stats_t") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- drivers/spi/spi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d94822bf3cec..85c552ba0725 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3079,6 +3079,7 @@ int spi_register_controller(struct spi_controller *ctlr) ctlr->pcpu_statistics = spi_alloc_pcpu_stats(dev); if (!ctlr->pcpu_statistics) { dev_err(dev, "Error allocating per-cpu statistics\n"); + status = -ENOMEM; goto destroy_queue; } -- 2.35.1