ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 16 Apr 2015 12:17:46 +0000 (20:17 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 17 Apr 2015 13:21:04 +0000 (14:21 +0100)
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.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
sound/soc/codecs/tfa9879.c

index 16f1b71..aab0af6 100644 (file)
@@ -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);