Commit 668f06b9 authored by Emil Goode's avatar Emil Goode Committed by Linus Torvalds

pps: return PTR_ERR on error in device_create

We should return PTR_ERR if the call to the device_create function fails.
Without this patch we instead return the value from a successful call to
cdev_add if the call to device_create fails.
Signed-off-by: default avatarEmil Goode <emilgoode@gmail.com>
Acked-by: default avatarDevendra Naga <devendra.aaru@gmail.com>
Cc: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Cc: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 25353b33
...@@ -327,8 +327,10 @@ int pps_register_cdev(struct pps_device *pps) ...@@ -327,8 +327,10 @@ int pps_register_cdev(struct pps_device *pps)
} }
pps->dev = device_create(pps_class, pps->info.dev, devt, pps, pps->dev = device_create(pps_class, pps->info.dev, devt, pps,
"pps%d", pps->id); "pps%d", pps->id);
if (IS_ERR(pps->dev)) if (IS_ERR(pps->dev)) {
err = PTR_ERR(pps->dev);
goto del_cdev; goto del_cdev;
}
pps->dev->release = pps_device_destruct; pps->dev->release = pps_device_destruct;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment