2015-04-16 12:18:51

by weiyj_lk

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Wei Yongjun <[email protected]>
---
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);


2015-04-16 13:08:35

by Peter Rosin

[permalink] [raw]
Subject: RE: [PATCH] ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe()

Wei Yongjun wrote:
> 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.

Acked-by: Peter Rosin <[email protected]>

Thanks,
Peter

2015-04-17 13:22:30

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: tfa9879: Fix return value check in tfa9879_i2c_probe()

On Thu, Apr 16, 2015 at 08:17:46PM +0800, [email protected] wrote:
> 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.

Applied, thanks.


Attachments:
(No filename) (298.00 B)
signature.asc (473.00 B)
Digital signature
Download all attachments