scsi: virtio_scsi: Remove a useless function call
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 29 May 2023 07:35:08 +0000 (09:35 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 31 May 2023 15:37:37 +0000 (11:37 -0400)
'inq_result' is known to be NULL. There is no point calling kfree().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/08740635cdb0f8293e57c557b22e048daae50961.1685345683.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/virtio_scsi.c

index 58498da..bd56336 100644 (file)
@@ -338,10 +338,8 @@ static int virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi)
        int result, inquiry_len, inq_result_len = 256;
        char *inq_result = kmalloc(inq_result_len, GFP_KERNEL);
 
-       if (!inq_result) {
-               kfree(inq_result);
+       if (!inq_result)
                return -ENOMEM;
-       }
 
        shost_for_each_device(sdev, shost) {
                inquiry_len = sdev->inquiry_len ? sdev->inquiry_len : 36;