public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] ndtest: Fix incorrect handling for return value of device_create_with_groups.
@ 2025-09-08 12:23 Lin Yujun
  2025-09-08 17:47 ` Dave Jiang
  0 siblings, 1 reply; 2+ messages in thread
From: Lin Yujun @ 2025-09-08 12:23 UTC (permalink / raw)
  To: dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny,
	linyujun809, santosh
  Cc: nvdimm, linux-kernel

The return value of device_create_with_groups will not
be an null pointer, use IS_ERR() to fix incorrect handling
return value of device_create_with_groups.

Fixes: 9399ab61ad82 ("ndtest: Add dimms to the two buses")
Signed-off-by: Lin Yujun <linyujun809@h-partners.com>
---
 tools/testing/nvdimm/test/ndtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index 68a064ce598c..7d722f2f7d62 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -745,11 +745,11 @@ static int ndtest_dimm_register(struct ndtest_priv *priv,
 
 	dimm->dev = device_create_with_groups(&ndtest_dimm_class,
 					     &priv->pdev.dev,
 					     0, dimm, dimm_attribute_groups,
 					     "test_dimm%d", id);
-	if (!dimm->dev) {
+	if (IS_ERR(dimm->dev)) {
 		pr_err("Could not create dimm device attributes\n");
 		return -ENOMEM;
 	}
 
 	return 0;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] ndtest: Fix incorrect handling for return value of device_create_with_groups.
  2025-09-08 12:23 [PATCH -next] ndtest: Fix incorrect handling for return value of device_create_with_groups Lin Yujun
@ 2025-09-08 17:47 ` Dave Jiang
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jiang @ 2025-09-08 17:47 UTC (permalink / raw)
  To: Lin Yujun, dan.j.williams, vishal.l.verma, ira.weiny, santosh
  Cc: nvdimm, linux-kernel



On 9/8/25 5:23 AM, Lin Yujun wrote:
> The return value of device_create_with_groups will not
> be an null pointer, use IS_ERR() to fix incorrect handling
> return value of device_create_with_groups.
> 
> Fixes: 9399ab61ad82 ("ndtest: Add dimms to the two buses")
> Signed-off-by: Lin Yujun <linyujun809@h-partners.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  tools/testing/nvdimm/test/ndtest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
> index 68a064ce598c..7d722f2f7d62 100644
> --- a/tools/testing/nvdimm/test/ndtest.c
> +++ b/tools/testing/nvdimm/test/ndtest.c
> @@ -745,11 +745,11 @@ static int ndtest_dimm_register(struct ndtest_priv *priv,
>  
>  	dimm->dev = device_create_with_groups(&ndtest_dimm_class,
>  					     &priv->pdev.dev,
>  					     0, dimm, dimm_attribute_groups,
>  					     "test_dimm%d", id);
> -	if (!dimm->dev) {
> +	if (IS_ERR(dimm->dev)) {
>  		pr_err("Could not create dimm device attributes\n");
>  		return -ENOMEM;
>  	}
>  
>  	return 0;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-08 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 12:23 [PATCH -next] ndtest: Fix incorrect handling for return value of device_create_with_groups Lin Yujun
2025-09-08 17:47 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox