From: Anton Vorontsov Date: Tue, 4 Mar 2008 22:28:43 +0000 (-0800) Subject: ds1wm: should check for IS_ERR(clk) instead of NULL X-Git-Tag: v2.6.25-rc4~67 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fcifs-2.6.git;a=commitdiff_plain;h=fbc357df2e7728feb010148bed4eccb03a181610 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: Anton Vorontsov Acked-by: Evgeniy Polyakov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c index 688e435b4d9a..78a14dacb8ec 100644 --- a/drivers/w1/masters/ds1wm.c +++ b/drivers/w1/masters/ds1wm.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -374,8 +375,8 @@ static int ds1wm_probe(struct platform_device *pdev) goto err1; ds1wm_data->clk = clk_get(&pdev->dev, "ds1wm"); - if (!ds1wm_data->clk) { - ret = -ENOENT; + if (IS_ERR(ds1wm_data->clk)) { + ret = PTR_ERR(ds1wm_data->clk); goto err2; }