Skip to contentSkip to conversation

dibs: Remove reset of static vars in dibs_init()

PATCH Applied Alexandra Winter 4 participants 7 messages Oct 23, 2025 – Oct 28, 2025

Subsystems (5)
lore
Share & tools
lore

Alexandra Winter

author maintainer
#0 lore raw

PATCH 1/2 dibs: Remove reset of static vars in dibs_init()

'clients' and 'max_client' are static variables and therefore don't need to be initialized.

---
 drivers/dibs/dibs_main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/dibs/dibs_main.c +0 -3
index 0374f8350ff7..b015578b4d2e 100644
@@ -254,9 +254,6 @@ static int __init dibs_init(void)
 {
 	int rc;
 
-	memset(clients, 0, sizeof(clients));
-	max_client = 0;
-
 	dibs_class = class_create("dibs");
 	if (IS_ERR(dibs_class))
 		return PTR_ERR(dibs_class);
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH 2/2 dibs: Use subsys_initcall()

In the case of built-in modules, the order of module_init() calls are derived from the Makefiles.

Use subsys_initcall() for the dibs module, to make sure dibs_init() is executed before dibs clients like smc and dibs devices like ism are initialized. So future dibs client or dibs device modules can use module_init() without the risk of getting the order in the Makefiles wrong.

---
 drivers/dibs/dibs_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dibs/dibs_main.c +1 -1
index b015578b4d2e..dac14d843af7 100644
@@ -271,5 +271,5 @@ static void __exit dibs_exit(void)
 	class_destroy(dibs_class);
 }
 
-module_init(dibs_init);
+subsys_initcall(dibs_init);
 module_exit(dibs_exit);
Signature · 1 line
2.48.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH net-next 2/2] dibs: Use subsys_initcall()

From: Alexandra Winter <[email protected]>
Date: Thu, 23 Oct 2025 17:06:36 +0200

Quoted 9 lines

In the case of built-in modules, the order of module_init() calls are derived from the Makefiles.

Use subsys_initcall() for the dibs module, to make sure dibs_init() is executed before dibs clients like smc and dibs devices like ism are initialized. So future dibs client or dibs device modules can use module_init() without the risk of getting the order in the Makefiles wrong.

Was this reported on LKML, so that you could add a 'Closes:' tag with the link here or the report was internal?

Quoted 1 line

Either way,

Quoted 9 lines
---
 drivers/dibs/dibs_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dibs/dibs_main.c +0 -0
index b015578b4d2e..dac14d843af7 100644

drivers/dibs/dibs_main.c static void __exit dibs_exit(void) · line 275

Quoted 6 lines
drivers/dibs/dibs_main.c +1 -1
@@ -271,5 +271,5 @@ static void __exit dibs_exit(void)
 	class_destroy(dibs_class);
 }
 
-module_init(dibs_init);
+subsys_initcall(dibs_init);
 module_exit(dibs_exit);

Thanks,
Olek

author maintainer
#3 lore raw

Re: [PATCH net-next 2/2] dibs: Use subsys_initcall()

Quoted 3 lines · Alexander Lobakin
Quoted 1 line

Was this reported on LKML, so that you could add a 'Closes:' tag with the link here or the report was internal?

It was an internal report, so no link available.
We still want to give credit for the colleague who spent time to report this issue outside of his main area.

Quoted 5 lines
Quoted 2 lines

Either way,

Thank you very much.

Reviewed-by on v1 1/2
#4 lore raw
In reply to Alexandra Winter

From: Alexandra Winter <[email protected]>
Date: Thu, 23 Oct 2025 17:06:35 +0200

Quoted 5 lines

'clients' and 'max_client' are static variables and therefore don't need to be initialized.

Quoted 9 lines
---
 drivers/dibs/dibs_main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/dibs/dibs_main.c +0 -0
index 0374f8350ff7..b015578b4d2e 100644

drivers/dibs/dibs_main.c static int __init dibs_init(void) · line 259

Quoted 9 lines
drivers/dibs/dibs_main.c +0 -3
@@ -254,9 +254,6 @@ static int __init dibs_init(void)
 {
 	int rc;
 
-	memset(clients, 0, sizeof(clients));
-	max_client = 0;
-
 	dibs_class = class_create("dibs");
 	if (IS_ERR(dibs_class))
 		return PTR_ERR(dibs_class);

Thanks,
Olek

Reviewed-by on v1 1/2
#5 lore raw
In reply to Alexandra Winter
Quoted 5 lines · Alexandra Winter

'clients' and 'max_client' are static variables and therefore don't need to be initialized.

Best regards,
Dust

Quoted 20 lines

---
drivers/dibs/dibs_main.c | 3 ---

1 file changed, 3 deletions(-)
drivers/dibs/dibs_main.c +0 -3
index 0374f8350ff7..b015578b4d2e 100644
@@ -254,9 +254,6 @@ static int __init dibs_init(void)
 {
 	int rc;
 
-	memset(clients, 0, sizeof(clients));
-	max_client = 0;
-
 	dibs_class = class_create("dibs");
 	if (IS_ERR(dibs_class))
 		return PTR_ERR(dibs_class);
Signature · 1 line
2.48.1
#6 lore raw
In reply to Alexandra Winter
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Thu, 23 Oct 2025 17:06:35 +0200 you wrote:

'clients' and 'max_client' are static variables and therefore don't need to be initialized.

---
 drivers/dibs/dibs_main.c | 3 ---
 1 file changed, 3 deletions(-)

Here is the summary with links:
- [net-next,1/2] dibs: Remove reset of static vars in dibs_init()

    https://git.kernel.org/netdev/net-next/c/182663bbff78
  - [net-next,2/2] dibs: Use subsys_initcall()
    https://git.kernel.org/netdev/net-next/c/968822086b74

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html