From f8c16a4508be2339080d1494ff1d9515ce91f185 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 6 May 2009 13:09:01 +0000 Subject: [PATCH] By popular request: Change the invalid device number and add a comment explaining the reasons behind it. Oh well, at least the commit count raises... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30644 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp b/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp index 0e19d94a72..383bc17b3d 100644 --- a/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp +++ b/src/add-ons/kernel/bus_managers/ata/ATAChannel.cpp @@ -293,7 +293,11 @@ ATAChannel::SelectedDevice() ata_task_file taskFile; if (_ReadRegs(&taskFile, ATA_MASK_DEVICE_HEAD) != B_OK) { TRACE_ERROR("reading register failed when detecting selected device\n"); - return 2; + // Return an invalid device number so that the + // SelectedDevice() == "expected device" check fails. + // Due to the device number being a bit, we can't really get values + // other than 0 and 1, so anything >= 2 can be regarded as invalid. + return 234; } return taskFile.lba.device;