mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 14:14:37 +00:00
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 <rui.silva@linaro.org> Reported-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
a92a2d46ac
commit
4a0c4453e3
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue