lkml.org 
[lkml]   [2020]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] scsi: virtio_scsi: remove unnecessary condition check
From
Date
On 09/07/20 17:06, Xianting Tian wrote:
> kmem_cache_destroy and mempool_destroy can correctly handle
> null pointer parameter, so there is no need to check if the
> parameter is null before calling kmem_cache_destroy and
> mempool_destroy.
>
> Signed-off-by: Xianting Tian <xianting_tian@126.com>
> ---
> drivers/scsi/virtio_scsi.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
> index bfec84a..54ac83e 100644
> --- a/drivers/scsi/virtio_scsi.c
> +++ b/drivers/scsi/virtio_scsi.c
> @@ -1003,14 +1003,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;
> }
>
>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>

\
 
 \ /
  Last update: 2020-07-09 17:25    [W:0.052 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site