mrf24j40: Fix en error handling path in 'mrf24j40_probe()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 8 Jul 2017 08:40:13 +0000 (10:40 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 25 Jul 2017 11:17:31 +0000 (13:17 +0200)
If this check fails, we must release some resources as done everywhere
else in this function before returning an error code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/net/ieee802154/mrf24j40.c

index 7d334963dc085c14fba2aa4508c8ea23c87b40b1..ee7084b2d52d323f4ba94153e8a91f5f65ad1d84 100644 (file)
@@ -1330,7 +1330,8 @@ static int mrf24j40_probe(struct spi_device *spi)
        if (spi->max_speed_hz > MAX_SPI_SPEED_HZ) {
                dev_warn(&spi->dev, "spi clock above possible maximum: %d",
                         MAX_SPI_SPEED_HZ);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err_register_device;
        }
 
        ret = mrf24j40_hw_init(devrec);