Skip to content

Commit

Permalink
ds1wm: should check for IS_ERR(clk) instead of NULL
Browse files Browse the repository at this point in the history
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 <cbouatmailru@gmail.com>
Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Anton Vorontsov authored and Linus Torvalds committed Mar 5, 2008
1 parent 4874cc1 commit fbc357d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/w1/masters/ds1wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/pm.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/ds1wm.h>

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit fbc357d

Please sign in to comment.