]> xenbits.xensource.com Git - seabios.git/commitdiff
scsi: Do not call printf() from scsi_is_ready()
authorKevin O'Connor <kevin@koconnor.net>
Wed, 23 Dec 2015 20:37:51 +0000 (15:37 -0500)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 15 Jan 2016 09:53:15 +0000 (10:53 +0100)
The scsi_is_ready() function may be called from a thread, and it is
not valid to call printf() from a thread.  Convert printf() to
dprintf() to avoid this possibility.

This does mean that cdrom detection (from cdrom_boot() ) may not give
notification of slow cdrom drives to a user.  However, the extra
medium detection time is unlikely to be large anyway.

Reported-by: Tobias Diedrich <tobiasdiedrich@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit 82f327976865ba151153a04b584fc5d0a1fc5d9b)

src/hw/blockcmd.c

index e20e3fc65887dfffe5f2026a9d89095e4a4a9e55..0725b46db6b464016054fe86e51d0c9fee9cc325 100644 (file)
@@ -168,7 +168,7 @@ scsi_is_ready(struct disk_op_s *op)
 
         if (sense.asc == 0x04 && sense.ascq == 0x01 && !in_progress) {
             /* IN PROGRESS OF BECOMING READY */
-            printf("Waiting for device to detect medium... ");
+            dprintf(1, "Waiting for device to detect medium... ");
             /* Allow 30 seconds more */
             end = timer_calc(30000);
             in_progress = 1;