From a92a2d46acd0bfb97ba409d9d663c270cb240715 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Tue, 15 Dec 2015 19:09:55 +0000 Subject: [PATCH] greybus: spi: validate spi master register Check for error in registering spi master, even though the current code will fail a little more ahead when trying to register devices in the master. Signed-off-by: Rui Miguel Silva Reported-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/spi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c index 41aa0ec1ced7..6e1146d474df 100644 --- a/drivers/staging/greybus/spi.c +++ b/drivers/staging/greybus/spi.c @@ -360,6 +360,8 @@ static int gb_spi_connection_init(struct gb_connection *connection) master->transfer_one_message = gb_spi_transfer_one_message; ret = spi_register_master(master); + if (ret < 0) + goto out_put_master; /* now, fetch the devices configuration */ for (i = 0; i < spi->num_chipselect; i++) { -- 2.20.1