Skip to content

Commit

Permalink
dm: use RCU_INIT_POINTER instead of rcu_assign_pointer in __unbind
Browse files Browse the repository at this point in the history
Replace rcu_assign_pointer(p, NULL) with RCU_INIT_POINTER(p, NULL).

The rcu_assign_pointer() ensures that the initialization of a structure
is carried out before storing a pointer to that structure.  And in the
case of the NULL pointer, there is no structure to initialize.  So,
rcu_assign_pointer(p, NULL) can be safely converted to
RCU_INIT_POINTER(p, NULL).

Signed-off-by: Monam Agarwal <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
  • Loading branch information
MonamAgarwal authored and snitm committed Mar 27, 2014
1 parent bfc6d41 commit 9cdb852
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2163,7 +2163,7 @@ static struct dm_table *__unbind(struct mapped_device *md)
return NULL;

dm_table_event_callback(map, NULL, NULL);
rcu_assign_pointer(md->map, NULL);
RCU_INIT_POINTER(md->map, NULL);
dm_sync_table(md);

return map;
Expand Down

0 comments on commit 9cdb852

Please sign in to comment.