Skip to contentSkip to conversation

ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe()

PATCH Applied [email protected] 3 participants 3 messages Apr 16, 2015 – Apr 17, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe()

From: Wei Yongjun <[email protected]>

In case of error, the function devm_kzalloc() returns NULL not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

---
 sound/soc/codecs/tfa9879.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/tfa9879.c +2 -2
index 16f1b71..aab0af6 100644
@@ -280,8 +280,8 @@ static int tfa9879_i2c_probe(struct i2c_client *i2c,
 	int i;
 
 	tfa9879 = devm_kzalloc(&i2c->dev, sizeof(*tfa9879), GFP_KERNEL);
-	if (IS_ERR(tfa9879))
-		return PTR_ERR(tfa9879);
+	if (!tfa9879)
+		return -ENOMEM;
 
 	i2c_set_clientdata(i2c, tfa9879);
 
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Wei Yongjun

In case of error, the function devm_kzalloc() returns NULL not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Thanks,
Peter