greybus: spi: validate spi master register
authorRui Miguel Silva <rui.silva@linaro.org>
Tue, 15 Dec 2015 19:09:55 +0000 (19:09 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 15 Dec 2015 22:32:12 +0000 (14:32 -0800)
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 <rui.silva@linaro.org>
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/spi.c

index 41aa0ec1ced7fef50f6d645dc26769e516285cee..6e1146d474df1e2ffae752197ff4cbc92fe6d60d 100644 (file)
@@ -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++) {