mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 05:24:12 +08:00
cc2520: remove 'ret' goto label
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 <varkab@cdac.in> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
5eb9f8caac
commit
f50f1c37a6
@ -844,10 +844,8 @@ static int cc2520_probe(struct spi_device *spi)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
|
priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
|
||||||
if (!priv) {
|
if (!priv)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto err_ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
spi_set_drvdata(spi, priv);
|
spi_set_drvdata(spi, priv);
|
||||||
|
|
||||||
@ -861,10 +859,8 @@ static int cc2520_probe(struct spi_device *spi)
|
|||||||
|
|
||||||
priv->buf = devm_kzalloc(&spi->dev,
|
priv->buf = devm_kzalloc(&spi->dev,
|
||||||
SPI_COMMAND_BUFFER, GFP_KERNEL);
|
SPI_COMMAND_BUFFER, GFP_KERNEL);
|
||||||
if (!priv->buf) {
|
if (!priv->buf)
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto err_ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_init(&priv->buffer_mutex);
|
mutex_init(&priv->buffer_mutex);
|
||||||
INIT_WORK(&priv->fifop_irqwork, cc2520_fifop_irqwork);
|
INIT_WORK(&priv->fifop_irqwork, cc2520_fifop_irqwork);
|
||||||
@ -981,8 +977,6 @@ static int cc2520_probe(struct spi_device *spi)
|
|||||||
err_hw_init:
|
err_hw_init:
|
||||||
mutex_destroy(&priv->buffer_mutex);
|
mutex_destroy(&priv->buffer_mutex);
|
||||||
flush_work(&priv->fifop_irqwork);
|
flush_work(&priv->fifop_irqwork);
|
||||||
|
|
||||||
err_ret:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user