Skip to content

Commit

Permalink
cc2520: remove 'ret' goto label
Browse files Browse the repository at this point in the history
If allocation of memory fails instead of going to ret goto label
and returning from there, we can directly return -ENOMEM on failure.

Signed-off-by: Varka Bhadram <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
bhadram authored and holtmann committed Dec 30, 2014
1 parent 5eb9f8c commit f50f1c3
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions drivers/net/ieee802154/cc2520.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,8 @@ static int cc2520_probe(struct spi_device *spi)
int ret;

priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
goto err_ret;
}
if (!priv)
return -ENOMEM;

spi_set_drvdata(spi, priv);

Expand All @@ -861,10 +859,8 @@ static int cc2520_probe(struct spi_device *spi)

priv->buf = devm_kzalloc(&spi->dev,
SPI_COMMAND_BUFFER, GFP_KERNEL);
if (!priv->buf) {
ret = -ENOMEM;
goto err_ret;
}
if (!priv->buf)
return -ENOMEM;

mutex_init(&priv->buffer_mutex);
INIT_WORK(&priv->fifop_irqwork, cc2520_fifop_irqwork);
Expand Down Expand Up @@ -981,8 +977,6 @@ static int cc2520_probe(struct spi_device *spi)
err_hw_init:
mutex_destroy(&priv->buffer_mutex);
flush_work(&priv->fifop_irqwork);

err_ret:
return ret;
}

Expand Down

0 comments on commit f50f1c3

Please sign in to comment.