[U-Boot] [PATCH] dm: blk: Fix get_desc to return block device descriptor

Michal Simek michal.simek at xilinx.com
Wed Nov 16 17:37:42 CET 2016


Current get_desc() implementation is not able to succesfully
finish and return pointer to block device descriptor.

Also function always return non zero value even device is found.

The patch fills block device descriptor and return 0 if device is found.

Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

I have tested it with blk scsi which I am reworking after first RFC.
With this patch I can run scsi part, scsi info, scsi read (I didn't test
write not to break my HDD).

---
 drivers/block/blk-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 6ba1026f5818..2e041c2b3dc7 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -156,6 +156,8 @@ static int get_desc(enum if_type if_type, int devnum, struct blk_desc **descp)
 				if (ret)
 					return ret;
 
+				*descp = desc;
+				return 0;
 			} else if (desc->devnum > devnum) {
 				found_more = true;
 			}
-- 
1.9.1



More information about the U-Boot mailing list