'device_create_with_groups()' returns an error pointer in case of error, not NULL. So test it with IS_ERR.
Signed-off-by: Christophe JAILLET <christophe.jail...@wanadoo.fr> --- tools/testing/nvdimm/test/nfit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index c9a6458cb63e..a99a1b64dd84 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c @@ -715,7 +715,7 @@ static int nfit_test0_alloc(struct nfit_test *t) &t->pdev.dev, 0, NULL, nfit_test_dimm_attribute_groups, "test_dimm%d", i); - if (!t->dimm_dev[i]) + if (IS_ERR(t->dimm_dev[i])) return -ENOMEM; } -- 2.9.3