Skip to contentSkip to conversation

rewrite the return method of static int s3c24xx_spi_setup(struct spi_device *spi) in drivers/spi/spi_s3c24xx.c

PATCH In review Helight.Xu 2 participants 2 messages Dec 10, 2008

Subsystems (2)
lore
Share & tools
lore

Helight.Xu

author
#0 lore raw

PATCH 1/1 rewrite the return method of static int s3c24xx_spi_setup(struct spi_device *spi) in drivers/spi/spi_s3c24xx.c

rewrite the return method of static int
s3c24xx_spi_setup(struct spi_device *spi)
in drivers/spi/spi_s3c24xx.c

reason:
s3c24xx_spi_setupxfer(spi, NULL) return 0 or -EINVAL, so here shoud return the ret,but only 0.

here:

 drivers/spi/spi_s3c24xx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi_s3c24xx.c +3 -3
index 3eb414b..0489254 100644
@@ -165,14 +165,14 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
        ret = s3c24xx_spi_setupxfer(spi, NULL);
        if (ret < 0) {
                dev_err(&spi->dev, "setupxfer returned %d\n", ret);
-               return ret;
+               goto err;
        }
 
        dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n",
                __func__, spi->mode, spi->bits_per_word,
                spi->max_speed_hz);
-                                                                                        
-       return 0;
+err:
+       return ret;
 }
 
 static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
Signature · 4 lines
---------------------------------
Zhenwen Xu - Open and Free
Home Page:	http://zhwen.org
My Studio:	http://dim4.cn
Quoted 1 line

From a99ab2a4a87f330125ed6263c16b4036d4991b89 Mon Sep 17 00:00:00 2001

From: Zhwen Xu <[email protected]>
Date: Wed, 10 Dec 2008 10:38:36 +0800
Subject: [PATCH] rewrite the return method of static int s3c24xx_spi_setup(struct spi_device *spi) in drivers/spi/spi_s3c24xx.c

---
 drivers/spi/spi_s3c24xx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi_s3c24xx.c +3 -3
index 3eb414b..0489254 100644
@@ -165,14 +165,14 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
 	ret = s3c24xx_spi_setupxfer(spi, NULL);
 	if (ret < 0) {
 		dev_err(&spi->dev, "setupxfer returned %d\n", ret);
-		return ret;
+		goto err;
 	}
 
 	dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n",
 		__func__, spi->mode, spi->bits_per_word,
 		spi->max_speed_hz);
-
-	return 0;
+err:
+	return ret;
 }
 
 static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 7 lines · Helight.Xu

rewrite the return method of static int
s3c24xx_spi_setup(struct spi_device *spi)
in drivers/spi/spi_s3c24xx.c

reason:
s3c24xx_spi_setupxfer(spi, NULL) return 0 or -EINVAL, so here shoud return the ret,but only 0.

The original code can return the correct value.
It contains 0 and -EINVAL, not only 0. So this change is not essential.

Signature · 3 lines
Jianjun Kong |Happy Hacking
Homepage: http://kongove.cn
Gtalk:[email protected]