Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: virtio_scsi: Remove a useless function call

'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>

authored by

Christophe JAILLET and committed by
Martin K. Petersen
0e5e41ee 401f8ef3

+1 -3
+1 -3
drivers/scsi/virtio_scsi.c
··· 338 338 int result, inquiry_len, inq_result_len = 256; 339 339 char *inq_result = kmalloc(inq_result_len, GFP_KERNEL); 340 340 341 - if (!inq_result) { 342 - kfree(inq_result); 341 + if (!inq_result) 343 342 return -ENOMEM; 344 - } 345 343 346 344 shost_for_each_device(sdev, shost) { 347 345 inquiry_len = sdev->inquiry_len ? sdev->inquiry_len : 36;