Commit 92e8d032 authored by Xianting Tian's avatar Xianting Tian Committed by Martin K. Petersen

scsi: virtio_scsi: Remove unnecessary condition check

kmem_cache_destroy() and mempool_destroy() both correctly handle null
pointer parameters. There is no need to check if the parameter is null
before calling these functions.

Link: https://lore.kernel.org/r/1594307167-8807-1-git-send-email-xianting_tian@126.comReviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarXianting Tian <xianting_tian@126.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent b92a4a9f
...@@ -1002,14 +1002,10 @@ static int __init init(void) ...@@ -1002,14 +1002,10 @@ static int __init init(void)
return 0; return 0;
error: error:
if (virtscsi_cmd_pool) { mempool_destroy(virtscsi_cmd_pool);
mempool_destroy(virtscsi_cmd_pool); virtscsi_cmd_pool = NULL;
virtscsi_cmd_pool = NULL; kmem_cache_destroy(virtscsi_cmd_cache);
} virtscsi_cmd_cache = NULL;
if (virtscsi_cmd_cache) {
kmem_cache_destroy(virtscsi_cmd_cache);
virtscsi_cmd_cache = NULL;
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment