From: Rui Miguel Silva Date: Tue, 15 Dec 2015 19:09:56 +0000 (+0000) Subject: greybus: spi: unregister master on device add fail X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a0c4453e3f99335db3e7786b1a66e3b6cfa0653;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: spi: unregister master on device add fail When registering devices if any of it fail, just cleanup and release spi master. Signed-off-by: Rui Miguel Silva Reported-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c index 6e1146d474df..e49dc56495b5 100644 --- a/drivers/staging/greybus/spi.c +++ b/drivers/staging/greybus/spi.c @@ -366,8 +366,12 @@ static int gb_spi_connection_init(struct gb_connection *connection) /* now, fetch the devices configuration */ for (i = 0; i < spi->num_chipselect; i++) { ret = gb_spi_setup_device(spi, i); - if (ret < 0) + if (ret < 0) { + dev_err(&connection->bundle->dev, + "failed to allocated spi device: %d\n", ret); + spi_unregister_master(master); break; + } } return ret;