Re: [PATCH -next] misc: genwqe: fix return value check ingenwqe_device_create()

From: Frank Haverkamp
Date: Tue Jan 07 2014 - 07:34:12 EST


Am Dienstag, den 07.01.2014, 16:56 +0800 schrieb Wei Yongjun:
> From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
>
> 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 <yongjun_wei@xxxxxxxxxxxxxxxxx>
> ---
> 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 <haver@xxxxxxxxxxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/