diff mbox

[v2] mrf24j40: Fix en error handling path in 'mrf24j40_probe()'

Message ID 20170708084013.18620-1-christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Headers show

Commit Message

Christophe JAILLET July 8, 2017, 8:40 a.m. UTC
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>
---
V2: initialization of ret in this erro path ws missing. Stupid me!
---
 drivers/net/ieee802154/mrf24j40.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alan Ott July 10, 2017, 7:24 p.m. UTC | #1
On 07/08/2017 04:40 AM, Christophe JAILLET wrote:
> 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>
> ---
> V2: initialization of ret in this erro path ws missing. Stupid me!
> ---
>  drivers/net/ieee802154/mrf24j40.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
> index 7d334963dc08..da8683782ffc 100644
> --- a/drivers/net/ieee802154/mrf24j40.c
> +++ b/drivers/net/ieee802154/mrf24j40.c
> @@ -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);
>

Acked-by: Alan Ott <alan@signal11.us>

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel Holtmann July 11, 2017, 6:48 a.m. UTC | #2
Hi Christophe,

> 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>
> ---
> V2: initialization of ret in this erro path ws missing. Stupid me!
> ---
> drivers/net/ieee802154/mrf24j40.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 7d334963dc08..da8683782ffc 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -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);