Messages in this thread | | | Subject | Re: [PATCH -next] misc: genwqe: fix return value check in genwqe_device_create() | From | Frank Haverkamp <> | Date | Tue, 07 Jan 2014 13:33:53 +0100 |
| |
Am Dienstag, den 07.01.2014, 16:56 +0800 schrieb Wei Yongjun: > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> > > 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@trendmicro.com.cn> > --- > 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@linux.vnet.ibm.com>
| |