forked from OERV-BSP/u-boot
The 'blks' variable in scsi_read/write/erase functions is updated regardless of pass/fail of the scsi operation . If the scsi operation fails, 'blkcnt' is updated using an incorrect value of 'blks'. This wrong 'blkcnt' is returned to the caller and it assumes all blocks were processed correctly. Fix this by updating the 'blks' variable only if the scsi operation succeeds. Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com> Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>