Skip to content

Commit

Permalink
greybus: spi: unregister master on device add fail
Browse files Browse the repository at this point in the history
When registering devices if any of it fail, just cleanup and release spi
master.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
  • Loading branch information
Rui Miguel Silva authored and Greg Kroah-Hartman committed Dec 15, 2015
1 parent a92a2d4 commit 4a0c445
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/staging/greybus/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4a0c445

Please sign in to comment.