Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1493591ybt; Thu, 9 Jul 2020 08:20:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiHe/NpxA0Mc7cj59COi0VDFv22zIygYwkQS1Jb/Mx7UDYhdOPZxtAWeat2iIh4cWRU6om X-Received: by 2002:a17:906:1414:: with SMTP id p20mr55765085ejc.247.1594308008727; Thu, 09 Jul 2020 08:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594308008; cv=none; d=google.com; s=arc-20160816; b=YEW2GtHfJoENB+rrxTjDnmOBLgTWGFPiymb7jMsOH5VC9BWIrZj5JD04I9E6zAfz2R 2U4bSEdn1jk1FhziTl4tmFfW994k5ZvX6a4YeryjuJcLLNyf2Rb2AynqDBKO/555galX EtcF5qjjXurgHlQkd7fiuAmtO1F7kvgpdS0svJ33qtPh0FUpAHDEGqtT3ClhSGtp5Z6j LH0UalOsDTaUVuRdBtiDcqYORIVTgagdY1OVmWpMqIGODb9AEaLtkYuzs2gyl4WTzFtZ fN7snlmzpBTQRo7cCIQFymRA1yZs5gXC4dFvhdyF4FWniVkWh8+RMAD+g/e3ZBcWkTiR WUFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=/LgYjZNguoFLQwNLPwQMJhRcOD+VgjClMKSQRTgSi+I=; b=U5+UxuiJFrZdXpvQd0uuqH13b8fSJgjTit2oMDNdGmKocd3RcHjW0XPYCbtVjlCZL3 GSDrgwgnoO8/OK8lOts5Vz+OTrMHHowDApLsSjBjJD6FJAKcffd0Yfh4OdSpLfJEJHie E+FP0U768en9PIuEo6tYohDT5uLpf1gnH7oXMLOHDTP4FN6V7f8LHSTbvSVmdr9EkI+V e9g3pSuRBhXwboZxJBxuiX6X+rc4lRA3ZvUXIL3ud3Y31KocBQzEEt8HuTwCMJ86K/b/ 2AD+E1sJOulmOnBuhgIMgNOjLsx2FBQtFrIH2RUWu2pXgD/8fKL79hlP8hDJNmI1LI1g uzDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b="lR+7/Yra"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si1952515ejf.411.2020.07.09.08.19.44; Thu, 09 Jul 2020 08:20:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b="lR+7/Yra"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbgGIPTH (ORCPT + 99 others); Thu, 9 Jul 2020 11:19:07 -0400 Received: from m15113.mail.126.com ([220.181.15.113]:43809 "EHLO m15113.mail.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728087AbgGIPSg (ORCPT ); Thu, 9 Jul 2020 11:18:36 -0400 X-Greylist: delayed 1859 seconds by postgrey-1.27 at vger.kernel.org; Thu, 09 Jul 2020 11:18:31 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=/LgYjZNguoFLQwNLPw QMJhRcOD+VgjClMKSQRTgSi+I=; b=lR+7/YraQf1f9P/fcok66ol6sfV/ch3EVt KakuqRIXOLPUhGybbNWYPo0hHsrk7T+ppQuO2axZt7o4IYBCW9TFvZVzbiTwpfhD gpbep0aluEdVkF5RqVMNXqS8j9yzEfpAroWLCQPG03j0/8Z42AIW5O0C8lZqX26N xckiSTy48= Received: from 192.168.137.252 (unknown [112.10.74.133]) by smtp3 (Coremail) with SMTP id DcmowAA3FATJLQdfCX7hHQ--.16361S3; Thu, 09 Jul 2020 22:46:35 +0800 (CST) From: Xianting Tian To: mst@redhat.com, jasowang@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, jejb@linux.ibm.com, martin.petersen@oracle.com Cc: virtualization@lists.linux-foundation.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: virtio_scsi: remove unnecessary condition check Date: Thu, 9 Jul 2020 10:46:32 -0400 Message-Id: <1594305992-8458-1-git-send-email-xianting_tian@126.com> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: DcmowAA3FATJLQdfCX7hHQ--.16361S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xw47tryktw1xCw43ZF48Crg_yoW3Krc_XF 4FqrsrGr15KFn2kry8GryfZrWY9anrZF40kr9YgFyfCr1Fqwn0gr1jqr1rZF4fWw4jk3W3 Cw4vyr1S9r1xGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8Tv3UUUUUU== X-Originating-IP: [112.10.74.133] X-CM-SenderInfo: h0ld03plqjs3xldqqiyswou0bp/1tbi5gtcpFpD+5LX2gAAso Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kmem_cache_destroy can correctly handle null pointer parameter, so there is no need to check if the parameter is null before calling kmem_cache_destroy. Signed-off-by: Xianting Tian --- drivers/scsi/virtio_scsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index bfec84a..5bc288f 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -1007,10 +1007,8 @@ static int __init init(void) mempool_destroy(virtscsi_cmd_pool); virtscsi_cmd_pool = NULL; } - if (virtscsi_cmd_cache) { - kmem_cache_destroy(virtscsi_cmd_cache); - virtscsi_cmd_cache = NULL; - } + kmem_cache_destroy(virtscsi_cmd_cache); + virtscsi_cmd_cache = NULL; return ret; } -- 1.8.3.1