Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757358AbbDPMSv (ORCPT ); Thu, 16 Apr 2015 08:18:51 -0400 Received: from m12-12.163.com ([220.181.12.12]:33633 "EHLO m12-12.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754827AbbDPMSn (ORCPT ); Thu, 16 Apr 2015 08:18:43 -0400 X-Coremail-DSSMTP: 49.77.26.90 From: weiyj_lk@163.com To: Peter Rosin , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Wei Yongjun , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe() Date: Thu, 16 Apr 2015 20:17:46 +0800 Message-Id: <1429186666-20547-1-git-send-email-weiyj_lk@163.com> X-Mailer: git-send-email 2.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-CM-TRANSID: DMCowEA5X3NrqC9V1f15Ag--.144S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4kZr1xur4kXryrJF1fZwb_yoW3Krg_K3 y8W34DZryFgFy3trWUJw4Ykas3uas7CrWUGr15Kas3AF95Grsakw4DJrnakF1UWFWkCFW3 JrsavF13A3sxJjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnEeH3UUUUU== X-Originating-IP: [49.77.26.90] X-CM-SenderInfo: pzhl5yxbonqiywtou0bp/1tbiJRzd1lUL3+83OwABsR Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1043 Lines: 32 From: 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. Signed-off-by: Wei Yongjun --- sound/soc/codecs/tfa9879.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c index 16f1b71..aab0af6 100644 --- a/sound/soc/codecs/tfa9879.c +++ b/sound/soc/codecs/tfa9879.c @@ -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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/