1. 15 1月, 2016 1 次提交
  2. 13 1月, 2016 5 次提交
    • M
      error: Clean up errors with embedded newlines (again) · 433672b0
      Markus Armbruster 提交于
      The arguments of error_report() should yield a short error string
      without newlines.
      
      A few places try to print additional help after the error message by
      embedding newlines in the error string.  That's nice, but let's do it
      the right way.  Commit 474c2134 cleaned up some, but they keep coming
      back.  Offenders tracked down with the Coccinelle semantic patch from
      commit 312fd5f2.
      
      Cc: Laszlo Ersek <lersek@redhat.com>
      Cc: Pavel Fedin <p.fedin@samsung.com>
      Signed-off-by: NMarkus Armbruster <armbru@pond.sub.org>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      433672b0
    • M
      pci-assign: Clean up "Failed to assign" error messages · c3d2d68a
      Markus Armbruster 提交于
      The arguments of error_setg() & friends should yield a short error
      string without newlines.
      
      Two places try to append additional help to the error message by
      embedding newlines in the error string.  That's nice, but let's do it
      the right way, with error_append_hint().
      
      Cc: Laszlo Ersek <lersek@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1450452927-8346-20-git-send-email-armbru@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      c3d2d68a
    • M
      error: Use error_reportf_err() where it makes obvious sense · c29b77f9
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch
      
          @@
          expression FMT, E, S;
          expression list ARGS;
          @@
          -    error_report(FMT, ARGS, error_get_pretty(E));
          +    error_reportf_err(E, FMT/*@@@*/, ARGS);
          (
          -    error_free(E);
          |
      	 exit(S);
          |
      	 abort();
          )
      
      followed by a replace of '%s"/*@@@*/' by '"' and some line rewrapping,
      because I can't figure out how to make Coccinelle transform strings.
      
      We now use the error whole instead of just its message obtained with
      error_get_pretty().  This avoids suppressing its hint (see commit
      50b7b000), but I can't see how the errors touched in this commit could
      come with hints.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1450452927-8346-12-git-send-email-armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      c29b77f9
    • M
      isa: Clean up error handling around isa_bus_new() · d10e5432
      Markus Armbruster 提交于
      We can have at most one ISA bus.  If you try to create another one,
      isa_bus_new() complains to stderr and returns null.
      
      isa_bus_new() is called in two contexts, machine's init() and device's
      realize() methods.  Since complaining to stderr is not proper in the
      latter context, convert isa_bus_new() to Error.
      
      Machine's init():
      
      * mips_jazz_init(), called from the init() methods of machines
        "magnum" and "pica"
      
      * mips_r4k_init(), the init() method of machine "mips"
      
      * pc_init1() called from the init() methods of non-q35 PC machines
      
      * typhoon_init(), called from clipper_init(), the init() method of
        machine "clipper"
      
      These callers always create the first ISA bus, hence isa_bus_new()
      can't fail.  Simply pass &error_abort.
      
      Device's realize():
      
      * i82378_realize(), of PCI device "i82378"
      
      * ich9_lpc_realize(), of PCI device "ICH9-LPC"
      
      * pci_ebus_realize(), of PCI device "ebus"
      
      * piix3_realize(), of PCI device "pci-piix3", abstract parent of
        "PIIX3" and "PIIX3-xen"
      
      * piix4_realize(), of PCI device "PIIX4"
      
      * vt82c686b_realize(), of PCI device "VT82C686B"
      
      Propagate the error.  Note that these devices are typically created
      only by machine init() methods with qdev_init_nofail() or similar.  If
      we screwed up and created an ISA bus before that call, we now give up
      right away.  Before, we'd hobble on, and typically die in
      isa_bus_irqs().  Similar if someone finds a way to hot-plug one of
      these critters.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: "Hervé Poussineau" <hpoussin@reactos.org>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Signed-off-by: NMarkus Armbruster <armbru@pond.sub.org>
      Reviewed-by: NMarcel Apfelbaum <marcel@redhat.com>
      Reviewed-by: NHervé Poussineau <hpoussin@reactos.org>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Message-Id: <1450370121-5768-11-git-send-email-armbru@redhat.com>
      d10e5432
    • M
      Use error_fatal to simplify obvious fatal errors · 007b0657
      Markus Armbruster 提交于
      Done with this Coccinelle semantic patch:
      
          @@
          type T;
          identifier FUN, RET;
          expression list ARGS;
          expression ERR, EC;
          @@
          (
          -    T RET = FUN(ARGS, &ERR);
          +    T RET = FUN(ARGS, &error_fatal);
          |
          -    RET = FUN(ARGS, &ERR);
          +    RET = FUN(ARGS, &error_fatal);
          |
          -    FUN(ARGS, &ERR);
          +    FUN(ARGS, &error_fatal);
          )
          -    if (ERR != NULL) {
          -        error_report_err(ERR);
          -        exit(EC);
          -    }
      
      This is actually a more elegant version of my initial semantic patch
      by courtesy of Eduardo.
      
      It leaves dead Error * variables behind, cleaned up manually.
      
      Cc: qemu-arm@nongnu.org
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      007b0657
  3. 10 1月, 2016 34 次提交