• Tejun Heo's avatar
    scsi: fix TUR error handling in sr_media_change() · 638428ec
    Tejun Heo authored
    sr_test_unit_ready() returns 0 iff TUR succeeded - IOW, when media is
    present and the device is actually ready, so the return value wouldn't
    be zero when TUR ends with sense data. sr_media_change() incorrectly
    tests (retval || (scsi_sense_valid(sshdr)...)) when it tries to test
    whether TUR failed without sense data or with sense data indicating
    media-not-present.
    
    Fix the test using scsi_status_is_good() and update comments.
    
    - Fixed a comment typo spotted by Eike.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
    Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
    638428ec
sr.c 23.8 KB