[PATCH] ocfs2: Remove redundant 0 value initialization

Liao Yuanhong posted 1 patch 1 month, 2 weeks ago
fs/ocfs2/cluster/heartbeat.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] ocfs2: Remove redundant 0 value initialization
Posted by Liao Yuanhong 1 month, 2 weeks ago
The o2hb_region struct is already zeroed by kzalloc(). It's redundant to
initialize reg->hr_region_num to 0.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 fs/ocfs2/cluster/heartbeat.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 724350925aff..18150dabdff9 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -2011,7 +2011,6 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
 	}
 
 	spin_lock(&o2hb_live_lock);
-	reg->hr_region_num = 0;
 	if (o2hb_global_heartbeat_active()) {
 		reg->hr_region_num = find_first_zero_bit(o2hb_region_bitmap,
 							 O2NM_MAX_REGIONS);
-- 
2.34.1
Re: [PATCH] ocfs2: Remove redundant 0 value initialization
Posted by Markus Elfring 1 month, 2 weeks ago
> The o2hb_region struct is already zeroed by kzalloc(). It's redundant to
> initialize reg->hr_region_num to 0.

See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc2#n94

Regards,
Markus