Commit 4a0c4453 authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Greg Kroah-Hartman

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: default avatarRui Miguel Silva <rui.silva@linaro.org>
Reported-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent a92a2d46
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment