From d52b095b6cb4dca3bdbc144e7098abdbbd45e9bc Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 14 Jun 2022 15:09:17 +0300 Subject: [PATCH] spi: core: Fix error code in spi_register_controller() 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 Link: https://lore.kernel.org/r/Yqh6bdNYO2XNhPBa@kili Signed-off-by: Mark Brown --- drivers/spi/spi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ac61824b87b5..c78d1ceeaa42 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3082,6 +3082,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; }