Skip to contentSkip to conversation

mmc/card/queue.c: change action when the condition of if is true

PATCH Venkatraman S 1 participant 1 message Oct 26, 2012 1 message not in the archive MMC, SD and SDIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 1 line · On Thursday 25 October 2012 06:29 PM, [email protected] wrote:

From: Jing Wang <[email protected]>

Some description of the actual effect of the change here would be nice. For example, "Trim the error handling path in mmc_alloc_sg". But what's the point of this patch anyway ? There are 2 "return" statements instead of one.

Quoted 29 lines
---
  drivers/mmc/card/queue.c |    9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/card/queue.c +5 -4
index e360a97..98a22a1 100644
@@ -118,13 +118,14 @@ static struct scatterlist *mmc_alloc_sg(int sg_len, int *err)
  	struct scatterlist *sg;
 
  	sg = kmalloc(sizeof(struct scatterlist)*sg_len, GFP_KERNEL);
-	if (!sg)
+	if (!sg) {
  		*err = -ENOMEM;
-	else {
-		*err = 0;
-		sg_init_table(sg, sg_len);
+		return sg;
  	}
 
+	*err = 0;
+	sg_init_table(sg, sg_len);
+
  	return sg;
  }