diff options
author | Xianting Tian <xianting_tian@126.com> | 2020-07-09 17:06:07 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2020-07-14 05:14:46 +0200 |
commit | 92e8d0323a5140c3e4a0e7098d3a5f43e2da87e8 (patch) | |
tree | 024d7dd323659aee923c3d11e2f55e0befd4f4f9 /drivers/scsi/virtio_scsi.c | |
parent | scsi: cxgb4i: Fix dereference of pointer tdata before it is null checked (diff) | |
download | linux-92e8d0323a5140c3e4a0e7098d3a5f43e2da87e8.tar.xz linux-92e8d0323a5140c3e4a0e7098d3a5f43e2da87e8.zip |
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.com
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Xianting Tian <xianting_tian@126.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/virtio_scsi.c')
-rw-r--r-- | drivers/scsi/virtio_scsi.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 0e0910c5b942..cea3e0aa9083 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -1002,14 +1002,10 @@ static int __init init(void) return 0; error: - if (virtscsi_cmd_pool) { - mempool_destroy(virtscsi_cmd_pool); - virtscsi_cmd_pool = NULL; - } - if (virtscsi_cmd_cache) { - kmem_cache_destroy(virtscsi_cmd_cache); - virtscsi_cmd_cache = NULL; - } + mempool_destroy(virtscsi_cmd_pool); + virtscsi_cmd_pool = NULL; + kmem_cache_destroy(virtscsi_cmd_cache); + virtscsi_cmd_cache = NULL; return ret; } |