diff mbox series

[-next] xen: xenbus: Use helper function IS_ERR_OR_NULL()

Message ID 20230817014736.3094289-1-lizetao1@huawei.com (mailing list archive)
State Accepted
Commit 035a69586f329e3e73750299695401e0c2b76ee2
Headers show
Series [-next] xen: xenbus: Use helper function IS_ERR_OR_NULL() | expand

Commit Message

Li Zetao Aug. 17, 2023, 1:47 a.m. UTC
Use IS_ERR_OR_NULL() to detect an error pointer or a null pointer
open-coding to simplify the code.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 drivers/xen/xenbus/xenbus_probe_frontend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jürgen Groß Aug. 17, 2023, 1:55 p.m. UTC | #1
On 17.08.23 03:47, Li Zetao wrote:
> Use IS_ERR_OR_NULL() to detect an error pointer or a null pointer
> open-coding to simplify the code.
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Jürgen Groß Aug. 22, 2023, 5:51 a.m. UTC | #2
On 17.08.23 03:47, Li Zetao wrote:
> Use IS_ERR_OR_NULL() to detect an error pointer or a null pointer
> open-coding to simplify the code.
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>

Pushed to xen/tip.git for-linus-6.6


Juergen
diff mbox series

Patch

diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 3f3836cb7279..fcb335bb7b18 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -429,7 +429,7 @@  static void xenbus_check_frontend(char *class, char *dev)
 		printk(KERN_DEBUG "XENBUS: frontend %s %s\n",
 				frontend, xenbus_strstate(fe_state));
 		backend = xenbus_read(XBT_NIL, frontend, "backend", NULL);
-		if (!backend || IS_ERR(backend))
+		if (IS_ERR_OR_NULL(backend))
 			goto out;
 		err = xenbus_scanf(XBT_NIL, backend, "state", "%i", &be_state);
 		if (err == 1)