Skip to contentSkip to conversation

scsi: ufs: remove unnecessary goto label

PATCH Applied Tiezhu Yang 2 participants 2 messages Jun 25, 2016 – Jul 15, 2016 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: remove unnecessary goto label

When buff_ascii kmalloc failed, there is no need to call kfree, it should return -ENOMEM directly, this patch fixes it.

---
 drivers/scsi/ufs/ufshcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -2
index 8e8989a..f08d41a 100644
@@ -2137,7 +2137,7 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, int desc_index, u8 *buf,
 		buff_ascii = kmalloc(ascii_len, GFP_KERNEL);
 		if (!buff_ascii) {
 			err = -ENOMEM;
-			goto out_free_buff;
+			goto out;
 		}
 
 		/*
@@ -2156,7 +2156,6 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, int desc_index, u8 *buf,
 				size - QUERY_DESC_HDR_SIZE);
 		memcpy(buf + QUERY_DESC_HDR_SIZE, buff_ascii, ascii_len);
 		buf[QUERY_DESC_LENGTH_OFFSET] = ascii_len + QUERY_DESC_HDR_SIZE;
-out_free_buff:
 		kfree(buff_ascii);
 	}
 out:
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tiezhu" == Tiezhu Yang <[email protected]> writes:

Tiezhu> When buff_ascii kmalloc failed, there is no need to call kfree, Tiezhu> it should return -ENOMEM directly, this patch fixes it.

Applied to 4.8/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering