Skip to content

Commit

Permalink
disk: Drop always true conditional check
Browse files Browse the repository at this point in the history
if (device_get_uclass_id(dev) == UCLASS_PARTITION) is always
true, because this disk_blk_read() function calls dev_get_blk()
above and checks its return value for non-NULL. The dev_get_blk()
performs the same device_get_uclass_id(dev) check and returns NULL
if not UCLASS_PARTITION. Drop the duplicate check.

Signed-off-by: Marek Vasut <[email protected]>
  • Loading branch information
Marek Vasut authored and trini committed Aug 22, 2023
1 parent 5ebe790 commit 5ff4609
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions disk/disk-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,8 @@ unsigned long disk_blk_read(struct udevice *dev, lbaint_t start,
return -ENOSYS;

start_in_disk = start;
if (device_get_uclass_id(dev) == UCLASS_PARTITION) {
part = dev_get_uclass_plat(dev);
start_in_disk += part->gpt_part_info.start;
}
part = dev_get_uclass_plat(dev);
start_in_disk += part->gpt_part_info.start;

if (blkcache_read(desc->uclass_id, desc->devnum, start_in_disk, blkcnt,
desc->blksz, buffer))
Expand Down

0 comments on commit 5ff4609

Please sign in to comment.