diff options
author | Stefan Wahren <stefan.wahren@i2se.com> | 2021-06-03 17:49:51 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-04 15:10:02 +0200 |
commit | eb928dad1604d0762d5bd677940cbb9dc0e74cc5 (patch) | |
tree | c50ee4ed54bfa422b34acb54d112099bff5cfd0e /drivers | |
parent | 447fbc14f4166c70a088ad2fc858fe7ca23aee88 (diff) | |
download | linux-eb928dad1604d0762d5bd677940cbb9dc0e74cc5.tar.bz2 |
staging: vchiq_arm: introduce free_bulk_waiter
Avoid the copy & paste of freeing the bulk waiter and move it into a
separate function. Found by CPD.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1622735405-9980-3-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index afbf01b7364c..2139b8dcba51 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -199,11 +199,24 @@ failed: } EXPORT_SYMBOL(vchiq_initialise); +static void free_bulk_waiter(struct vchiq_instance *instance) +{ + struct bulk_waiter_node *waiter, *next; + + list_for_each_entry_safe(waiter, next, + &instance->bulk_waiter_list, list) { + list_del(&waiter->list); + vchiq_log_info(vchiq_arm_log_level, + "bulk_waiter - cleaned up %pK for pid %d", + waiter, waiter->pid); + kfree(waiter); + } +} + enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance) { enum vchiq_status status = VCHIQ_SUCCESS; struct vchiq_state *state = instance->state; - struct bulk_waiter_node *waiter, *next; if (mutex_lock_killable(&state->mutex)) return VCHIQ_RETRY; @@ -216,14 +229,7 @@ enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance) vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, status); - list_for_each_entry_safe(waiter, next, - &instance->bulk_waiter_list, list) { - list_del(&waiter->list); - vchiq_log_info(vchiq_arm_log_level, - "bulk_waiter - cleaned up %pK for pid %d", - waiter, waiter->pid); - kfree(waiter); - } + free_bulk_waiter(instance); kfree(instance); return status; @@ -1943,18 +1949,7 @@ static int vchiq_release(struct inode *inode, struct file *file) /* Release the PEER service count. */ vchiq_release_internal(instance->state, NULL); - { - struct bulk_waiter_node *waiter, *next; - - list_for_each_entry_safe(waiter, next, - &instance->bulk_waiter_list, list) { - list_del(&waiter->list); - vchiq_log_info(vchiq_arm_log_level, - "bulk_waiter - cleaned up %pK for pid %d", - waiter, waiter->pid); - kfree(waiter); - } - } + free_bulk_waiter(instance); vchiq_debugfs_remove_instance(instance); |