Skip to content

Commit b424f73

Browse files
Wang Haibebarino
authored andcommitted
clk: lmk04832: fix return value check in lmk04832_probe()
In case of error, the function devm_kzalloc() and devm_kcalloc() return NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 3bc61cf ("clk: add support for the lmk04832") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Wang Hai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Liam Beguin <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent b1f2477 commit b424f73

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/clk/clk-lmk04832.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,23 +1425,23 @@ static int lmk04832_probe(struct spi_device *spi)
14251425

14261426
lmk->dclk = devm_kcalloc(lmk->dev, info->num_channels >> 1,
14271427
sizeof(struct lmk_dclk), GFP_KERNEL);
1428-
if (IS_ERR(lmk->dclk)) {
1429-
ret = PTR_ERR(lmk->dclk);
1428+
if (!lmk->dclk) {
1429+
ret = -ENOMEM;
14301430
goto err_disable_oscin;
14311431
}
14321432

14331433
lmk->clkout = devm_kcalloc(lmk->dev, info->num_channels,
14341434
sizeof(*lmk->clkout), GFP_KERNEL);
1435-
if (IS_ERR(lmk->clkout)) {
1436-
ret = PTR_ERR(lmk->clkout);
1435+
if (!lmk->clkout) {
1436+
ret = -ENOMEM;
14371437
goto err_disable_oscin;
14381438
}
14391439

14401440
lmk->clk_data = devm_kzalloc(lmk->dev, struct_size(lmk->clk_data, hws,
14411441
info->num_channels),
14421442
GFP_KERNEL);
1443-
if (IS_ERR(lmk->clk_data)) {
1444-
ret = PTR_ERR(lmk->clk_data);
1443+
if (!lmk->clk_data) {
1444+
ret = -ENOMEM;
14451445
goto err_disable_oscin;
14461446
}
14471447

0 commit comments

Comments
 (0)