[SeaBIOS] [PATCH 1/2] scsi: Do not call printf() from scsi_is_ready()

Kevin O'Connor kevin at koconnor.net
Wed Dec 23 21:48:48 CET 2015


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 at gmail.com>
Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/hw/blockcmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index e20e3fc..0725b46 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -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;
-- 
2.5.0




More information about the SeaBIOS mailing list