From: Hans de Goede Date: Sat, 20 Sep 2025 20:07:07 +0000 (+0200) Subject: platform/x86: x86-android-tablets: Simplify node-group [un]registration X-Git-Tag: v6.18-rc1~82^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bb596a7d2375d2a2218b0cc5b028f0f86e9fed9;p=thirdparty%2Fkernel%2Flinux.git platform/x86: x86-android-tablets: Simplify node-group [un]registration software_node_register_node_group() / software_node_unregister_node_group() both accept a NULL node-group as argument. So there is no need to check for the node-group being NULL before calling these functions, remove the checks to simplify the code. Note the "if (gpio_button_swnodes)" check for registering is kept because that also guards the creation of a gpio-button platform-device. Suggested-by: Andy Shevchenko Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko Link: https://patch.msgid.link/20250920200713.20193-15-hansg@kernel.org Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen --- diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c index 5675e888d84f8..d0638664d1daf 100644 --- a/drivers/platform/x86/x86-android-tablets/core.c +++ b/drivers/platform/x86/x86-android-tablets/core.c @@ -387,14 +387,9 @@ static void x86_android_tablet_remove(struct platform_device *pdev) if (exit_handler) exit_handler(); - if (gpio_button_swnodes) - software_node_unregister_node_group(gpio_button_swnodes); - - if (swnode_group) - software_node_unregister_node_group(swnode_group); - - if (gpiochip_node_group) - software_node_unregister_node_group(gpiochip_node_group); + software_node_unregister_node_group(gpio_button_swnodes); + software_node_unregister_node_group(swnode_group); + software_node_unregister_node_group(gpiochip_node_group); } static __init int x86_android_tablet_probe(struct platform_device *pdev) @@ -430,20 +425,16 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev) break; } - if (gpiochip_node_group) { - ret = software_node_register_node_group(gpiochip_node_group); - if (ret) - return ret; - } + ret = software_node_register_node_group(gpiochip_node_group); + if (ret) + return ret; - if (dev_info->swnode_group) { - ret = software_node_register_node_group(dev_info->swnode_group); - if (ret) { - x86_android_tablet_remove(pdev); - return ret; - } - swnode_group = dev_info->swnode_group; + ret = software_node_register_node_group(dev_info->swnode_group); + if (ret) { + x86_android_tablet_remove(pdev); + return ret; } + swnode_group = dev_info->swnode_group; if (dev_info->init) { ret = dev_info->init(&pdev->dev);