ASoC: checking kzalloc() for IS_ERR() instead of NULL
Subsystems (4)
PATCH 1/1 ASoC: checking kzalloc() for IS_ERR() instead of NULL
There is a typo here that got copy and pasted to several probe functions. kzalloc() returns NULL on allocation failures and not an ERR_PTR.
Signed-off-by Dan Carpenter <[email protected]>
sound/soc/codecs/wm8804.c +4 -4
@@ -720,8 +720,8 @@ static int __devinit wm8804_spi_probe(struct spi_device *spi)int ret; wm8804 =kzalloc (sizeof *wm8804,GFP_KERNEL ); -if (IS_ERR (wm8804)) -return PTR_ERR (wm8804); +if (!wm8804) +return -ENOMEM ; wm8804->control_type =SND_SOC_SPI ;spi_set_drvdata (spi, wm8804);
@@ -758,8 +758,8 @@ static __devinit int wm8804_i2c_probe(struct i2c_client *i2c,int ret; wm8804 =kzalloc (sizeof *wm8804,GFP_KERNEL ); -if (IS_ERR (wm8804)) -return PTR_ERR (wm8804); +if (!wm8804) +return -ENOMEM ; wm8804->control_type =SND_SOC_I2C ;i2c_set_clientdata (i2c, wm8804);
sound/soc/codecs/wm8985.c +4 -4
@@ -1079,8 +1079,8 @@ static int __devinit wm8985_spi_probe(struct spi_device *spi)int ret; wm8985 =kzalloc (sizeof *wm8985,GFP_KERNEL ); -if (IS_ERR (wm8985)) -return PTR_ERR (wm8985); +if (!wm8985) +return -ENOMEM ; wm8985->control_type =SND_SOC_SPI ;spi_set_drvdata (spi, wm8985);
@@ -1117,8 +1117,8 @@ static __devinit int wm8985_i2c_probe(struct i2c_client *i2c,int ret; wm8985 =kzalloc (sizeof *wm8985,GFP_KERNEL ); -if (IS_ERR (wm8985)) -return PTR_ERR (wm8985); +if (!wm8985) +return -ENOMEM ; wm8985->control_type =SND_SOC_I2C ;i2c_set_clientdata (i2c, wm8985);
Quoted 6 lines · Dan Carpenter
There is a typo here that got copy and pasted to several probe functions.
kzalloc()returns NULL on allocation failures and not anERR_PTR.Signed-off-by Dan Carpenter <[email protected]>
Acked-by Liam Girdwood <[email protected]>
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Quoted 6 lines · Dan Carpenter
There is a typo here that got copy and pasted to several probe functions.
kzalloc()returns NULL on allocation failures and not anERR_PTR.Signed-off-by Dan Carpenter <[email protected]>
Thanks for noticing this.
Mark Brown
AppliedQuoted 5 lines · Dan Carpenter
There is a typo here that got copy and pasted to several probe functions.
kzalloc()returns NULL on allocation failures and not anERR_PTR.Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks.