Once the src_info is removed from the global list, no one can access it.
This simplies the usage of spin_unlock() in papr_hvpipe_handle_release()

Signed-off-by: Ritesh Harjani (IBM) <[email protected]>
---
 arch/powerpc/platforms/pseries/papr-hvpipe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c 
b/arch/powerpc/platforms/pseries/papr-hvpipe.c
index fffebbae113c..57ec50e3e883 100644
--- a/arch/powerpc/platforms/pseries/papr-hvpipe.c
+++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c
@@ -455,6 +455,7 @@ static int papr_hvpipe_handle_release(struct inode *inode,
        src_info = file->private_data;
        list_del(&src_info->list);
        file->private_data = NULL;
+       spin_unlock(&hvpipe_src_list_lock);
        /*
         * If the pipe for this specific source has any pending
         * payload, issue recv HVPIPE RTAS so that pipe will not
@@ -462,10 +463,8 @@ static int papr_hvpipe_handle_release(struct inode *inode,
         */
        if (src_info->hvpipe_status & HVPIPE_MSG_AVAILABLE) {
                src_info->hvpipe_status = 0;
-               spin_unlock(&hvpipe_src_list_lock);
                hvpipe_rtas_recv_msg(NULL, 0);
-       } else
-               spin_unlock(&hvpipe_src_list_lock);
+       }
 
        kfree(src_info);
        return 0;
-- 
2.39.5


Reply via email to