Re: [PATCH 1/1] mmc/card/queue.c: change action when the condition of if is true

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 25 October 2012 06:29 PM, Wang.Jing.windsdaemon@xxxxxxxxx wrote:
From: Jing Wang <windsdaemon@xxxxxxxxx>
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.

Signed-off-by: Jing Wang <windsdaemon@xxxxxxxxx>
---
  drivers/mmc/card/queue.c |    9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index e360a97..98a22a1 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -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;
  }

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux