hw/block/fdc: Replace error_setg(&error_abort) by assert()
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Fri, 29 Jun 2018 14:11:00 +0000 (15:11 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 29 Jun 2018 14:11:00 +0000 (15:11 +0100)
Use assert() instead of error_setg(&error_abort),
as suggested by the "qapi/error.h" documentation:

    Please don't error_setg(&error_fatal, ...), use error_report() and
    exit(), because that's more obvious.
    Likewise, don't error_setg(&error_abort, ...), use assert().

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: John Snow <jsnow@redhat.com>
Message-id: 20180625165749.3910-2-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/block/fdc.c

index cd29e27d8f594338463d4b858eeda12253e32b17..7c1c57f57fa6801ff31a266cefe0bad9c320f90f 100644 (file)
@@ -396,16 +396,9 @@ static int pick_geometry(FDrive *drv)
                            nb_sectors,
                            FloppyDriveType_str(parse->drive));
         }
+        assert(type_match != -1 && "misconfigured fd_format");
         match = type_match;
     }
-
-    /* No match of any kind found -- fd_format is misconfigured, abort. */
-    if (match == -1) {
-        error_setg(&error_abort, "No candidate geometries present in table "
-                   " for floppy drive type '%s'",
-                   FloppyDriveType_str(drv->drive));
-    }
-
     parse = &(fd_formats[match]);
 
  out: