spi: spi-rpc-if: Check return value of rpcif_sw_init()
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Mon, 25 Oct 2021 20:56:27 +0000 (21:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 13:04:11 +0000 (14:04 +0100)
[ Upstream commit 0b0a281ed7001d4c4f4c47bdc84680c4997761ca ]

rpcif_sw_init() can fail so make sure we check the return value
of it and on error exit rpcif_spi_probe() callback with error code.

Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20211025205631.21151-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-rpc-if.c

index 3579675485a5ef3ab28d455d9fc00a6d54d4e7e7..727d7cf0a6ad8518090dc4a8c31c096d9859f826 100644 (file)
@@ -139,7 +139,9 @@ static int rpcif_spi_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        rpc = spi_controller_get_devdata(ctlr);
-       rpcif_sw_init(rpc, parent);
+       error = rpcif_sw_init(rpc, parent);
+       if (error)
+               return error;
 
        platform_set_drvdata(pdev, ctlr);