Patchwork [U-Boot,3/4] sf: Add debug messages on spi_flash_read_common

login
register
mail settings
Submitter Jagannadha Sutradharudu Teki
Date June 14, 2013, 8:18 p.m.
Message ID <bed84192-4279-4adc-8593-6903086c7670@DB8EHSMHS013.ehs.local>
Download mbox | patch
Permalink /patch/251522/
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Jagannadha Sutradharudu Teki - June 14, 2013, 8:18 p.m.
- Added debug's on spi_flash_read_common()
- Added space

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
---
 drivers/mtd/spi/spi_flash.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index cb38b66..f3245a4 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -252,8 +252,18 @@  int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
 	struct spi_slave *spi = flash->spi;
 	int ret;
 
-	spi_claim_bus(spi);
+	ret = spi_claim_bus(flash->spi);
+	if (ret) {
+		debug("SF: Unable to claim SPI bus\n");
+		return ret;
+	}
+
 	ret = spi_flash_cmd_read(spi, cmd, cmd_len, data, data_len);
+	if (ret < 0) {
+		debug("SF: read cmd failed\n");
+		return ret;
+	}
+
 	spi_release_bus(spi);
 
 	return ret;