提交 fbc357df 编写于 作者: A Anton Vorontsov 提交者: Linus Torvalds

ds1wm: should check for IS_ERR(clk) instead of NULL

On the error condition clk_get() returns ERR_PTR(..), so checking for NULL
doesn't work.  ds1wm module causes a kernel oops when ds1wm clock isn't
registered.

This patch converts NULL check to IS_ERR(), plus uses PTR_ERR()
for the return code.
Signed-off-by: NAnton Vorontsov <cbouatmailru@gmail.com>
Acked-by: NEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 4874cc1b
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ds1wm.h> #include <linux/ds1wm.h>
...@@ -374,8 +375,8 @@ static int ds1wm_probe(struct platform_device *pdev) ...@@ -374,8 +375,8 @@ static int ds1wm_probe(struct platform_device *pdev)
goto err1; goto err1;
ds1wm_data->clk = clk_get(&pdev->dev, "ds1wm"); ds1wm_data->clk = clk_get(&pdev->dev, "ds1wm");
if (!ds1wm_data->clk) { if (IS_ERR(ds1wm_data->clk)) {
ret = -ENOENT; ret = PTR_ERR(ds1wm_data->clk);
goto err2; goto err2;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册