diff options
author | Simon Glass <sjg@chromium.org> | 2023-04-25 10:54:50 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-04-27 13:51:07 -0400 |
commit | d7d57436e7a65cb724d04d987cd00428aea995a5 (patch) | |
tree | 99068cf1f1952039d6fd9eca95f105871530cd9d /drivers | |
parent | 960831180380e8060d8a6af5317ae756b9f6d186 (diff) | |
download | u-boot-d7d57436e7a65cb724d04d987cd00428aea995a5.zip u-boot-d7d57436e7a65cb724d04d987cd00428aea995a5.tar.gz u-boot-d7d57436e7a65cb724d04d987cd00428aea995a5.tar.bz2 |
ide: Use a single local blk_desc for ide_ident()
We only use one member of the ide_dev_desc[] array at a time and it does
not stick around outside ide_probe(). Use a single element instead.
Copy over the missing members of blk_desc at the same, since this was
missing from the previous code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model")
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/ide.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/block/ide.c b/drivers/block/ide.c index b1c897d..4c2a6a8 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1005,7 +1005,6 @@ BOOTDEV_HUNTER(ide_bootdev_hunter) = { static int ide_probe(struct udevice *udev) { - struct blk_desc ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE]; bool bus_ok[CONFIG_SYS_IDE_MAXBUS]; int i, bus; @@ -1028,7 +1027,7 @@ static int ide_probe(struct udevice *udev) schedule(); for (i = 0; i < CONFIG_SYS_IDE_MAXDEVICE; i++) { - struct blk_desc *desc; + struct blk_desc *desc, pdesc; struct udevice *blk; lbaint_t size; char name[20]; @@ -1038,16 +1037,16 @@ static int ide_probe(struct udevice *udev) if (!bus_ok[IDE_BUS(i)]) continue; - ret = ide_ident(i, &ide_dev_desc[i]); - dev_print(&ide_dev_desc[i]); + ret = ide_ident(i, &pdesc); + dev_print(&pdesc); if (ret) continue; sprintf(name, "blk#%d", i); - blksz = ide_dev_desc[i].blksz; - size = blksz * ide_dev_desc[i].lba; + blksz = pdesc.blksz; + size = blksz * pdesc.lba; /* * With CDROM, if there is no CD inserted, blksz will @@ -1066,12 +1065,13 @@ static int ide_probe(struct udevice *udev) /* fill in device vendor/product/rev strings */ desc = dev_get_uclass_plat(blk); - strlcpy(desc->vendor, ide_dev_desc[desc->devnum].vendor, - BLK_VEN_SIZE); - strlcpy(desc->product, ide_dev_desc[desc->devnum].product, - BLK_PRD_SIZE); - strlcpy(desc->revision, ide_dev_desc[desc->devnum].revision, - BLK_REV_SIZE); + strlcpy(desc->vendor, pdesc.vendor, BLK_VEN_SIZE); + strlcpy(desc->product, pdesc.product, BLK_PRD_SIZE); + strlcpy(desc->revision, pdesc.revision, BLK_REV_SIZE); + desc->removable = pdesc.removable; + desc->atapi = pdesc.atapi; + desc->lba48 = pdesc.lba48; + desc->type = pdesc.type; ret = bootdev_setup_for_dev(udev, "ide_bootdev"); if (ret) |