]> git.ipfire.org Git - people/ms/u-boot.git/commit
dm: scsi: fix divide-by-0 error in scsi_scan()
authorJean-Jacques Hiblot <jjhiblot@ti.com>
Fri, 7 Apr 2017 11:42:08 +0000 (13:42 +0200)
committerSimon Glass <sjg@chromium.org>
Sat, 15 Apr 2017 01:38:57 +0000 (19:38 -0600)
commit4e27b9a5845e9c061b315b7ca301eff982d6898f
tree787b5d8751c4b3ec557672177760383e6bb11646
parent1330a726ff0c8164cf6035ab4a6d1e31805f69d1
dm: scsi: fix divide-by-0 error in scsi_scan()

With DM_SCSI enabled, blk_create_devicef() is called with blkz = 0, leading
to a divide-by-0 exception.
scsi_detect_dev() can be used to get the required parameters (block size
and number of blocks) from the drive before calling blk_create_devicef().

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/scsi.c