From: Wei Yongjun <[email protected]>
In case of error, the function device_create_with_groups()
returns ERR_PTR() and never returns NULL. The NULL test in
the return value check should be replaced with IS_ERR().
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/misc/genwqe/card_dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
index 9b231bb..46fa2ca 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -1378,8 +1378,8 @@ int genwqe_device_create(struct genwqe_dev *cd)
genwqe_attribute_groups,
GENWQE_DEVNAME "%u_card",
cd->card_idx);
- if (cd->dev == NULL) {
- rc = -ENODEV;
+ if (IS_ERR(cd->dev)) {
+ rc = PTR_ERR(cd->dev);
goto err_cdev;
}
Am Dienstag, den 07.01.2014, 16:56 +0800 schrieb Wei Yongjun:
> From: Wei Yongjun <[email protected]>
>
> In case of error, the function device_create_with_groups()
> returns ERR_PTR() and never returns NULL. The NULL test in
> the return value check should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> drivers/misc/genwqe/card_dev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
> index 9b231bb..46fa2ca 100644
> --- a/drivers/misc/genwqe/card_dev.c
> +++ b/drivers/misc/genwqe/card_dev.c
> @@ -1378,8 +1378,8 @@ int genwqe_device_create(struct genwqe_dev *cd)
> genwqe_attribute_groups,
> GENWQE_DEVNAME "%u_card",
> cd->card_idx);
> - if (cd->dev == NULL) {
> - rc = -ENODEV;
> + if (IS_ERR(cd->dev)) {
> + rc = PTR_ERR(cd->dev);
> goto err_cdev;
> }
>
>
Thanks for finding this potential problem and proposing a fix.
Acked-by: Frank Haverkamp <[email protected]>