Skip to contentSkip to conversation

Fix error_report() calls

PATCH Applied Markus Armbruster 3 participants 8 messages Jun 22, 2011 – Jun 23, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix error_report() calls

I limited myself to truly trivial fixes. I hope that's still useful enough to excuse a little rant.

"bug: 0 0" is not a useful error message. Neither are "Desc next is 128", " too short" (too short indeed), "wrong magic" (some "wrong magic" skills will be handy to figure out what went wrong). I'm stopping here for brevity's sake, not for want of examples.

If you can't be bothered to provide an intelligible error message and *test* it to verify it actually makes sense for the user, maybe you should stick to assert() or something. Makes your laziness stand out properly.

Markus Armbruster (5):
sheepdog: qemu_bh_new() can't return null pointer, drop check Strip trailing '\n' from error_report()'s first argument
qemu-img: Don't prepend qemu-img to error messages twice. Spell "unkown" correctly in error_report() arguments
blockdev: Put space after comma in error message

 block-migration.c       |    2 +-
 block/qcow2.c           |    2 +-
 block/sheepdog.c        |   90 ++++++++++++++++++++++-------------------------
 blockdev.c              |    2 +-
 hw/lm32_sys.c           |    2 +-
 hw/lm32_timer.c         |    4 +-
 hw/lm32_uart.c          |    4 +-
 hw/milkymist-ac97.c     |    4 +-
 hw/milkymist-memcard.c  |    4 +-
 hw/milkymist-minimac2.c |    6 ++--
 hw/milkymist-pfpu.c     |    4 +-
 hw/milkymist-softusb.c  |    8 ++--
 hw/milkymist-sysctl.c   |    4 +-
 hw/milkymist-tmu2.c     |    8 ++--
 hw/qdev.c               |    2 +-
 hw/strongarm.c          |    4 +-
 hw/usb-ccid.c           |    2 +-
 hw/virtio-serial-bus.c  |   10 +++---
 hw/virtio.c             |    4 +-
 net.c                   |    2 +-
 net/socket.c            |    6 ++--
 qemu-error.c            |    2 +
 qemu-img.c              |   12 +++---
 23 files changed, 92 insertions(+), 96 deletions(-)
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH 5/5 blockdev: Put space after comma in error message

---
 blockdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
blockdev.c +1 -1
index 1502575..7d579d6 100644
@@ -293,7 +293,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi)
 
     if ((buf = qemu_opt_get(opts, "trans")) != NULL) {
         if (!cyls) {
-            error_report("'%s' trans must be used with cyls,heads and secs",
+            error_report("'%s' trans must be used with cyls, heads and secs",
                          buf);
             return NULL;
         }
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/5 sheepdog: qemu_bh_new() can't return null pointer, drop check

In reply to Markus Armbruster
---
 block/sheepdog.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
block/sheepdog.c +0 -6
index 0392ca8..2180299 100644
@@ -449,13 +449,7 @@ static int sd_schedule_bh(QEMUBHFunc *cb, SheepdogAIOCB *acb)
     }
 
     acb->bh = qemu_bh_new(cb, acb);
-    if (!acb->bh) {
-        error_report("oom: %d %d\n", acb->aiocb_type, acb->aiocb_type);
-        return -EIO;
-    }
-
     qemu_bh_schedule(acb->bh);
-
     return 0;
 }
 
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 3/5 qemu-img: Don't prepend qemu-img to error messages twice.

In reply to Markus Armbruster

error_report() prepends the location already. Example:

$ qemu-img convert -6
qemu-img: qemu-img: option -6 is deprecated, please use '-o compat6' instead!
---
 qemu-img.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
qemu-img.c +4 -4
index 1a37828..32628b3 100644
@@ -304,11 +304,11 @@ static int img_create(int argc, char **argv)
             fmt = optarg;
             break;
         case 'e':
-            error_report("qemu-img: option -e is deprecated, please use \'-o "
+            error_report("option -e is deprecated, please use \'-o "
                   "encryption\' instead!");
             return 1;
         case '6':
-            error_report("qemu-img: option -6 is deprecated, please use \'-o "
+            error_report("option -6 is deprecated, please use \'-o "
                   "compat6\' instead!");
             return 1;
         case 'o':
@@ -633,11 +633,11 @@ static int img_convert(int argc, char **argv)
             compress = 1;
             break;
         case 'e':
-            error_report("qemu-img: option -e is deprecated, please use \'-o "
+            error_report("option -e is deprecated, please use \'-o "
                   "encryption\' instead!");
             return 1;
         case '6':
-            error_report("qemu-img: option -6 is deprecated, please use \'-o "
+            error_report("option -6 is deprecated, please use \'-o "
                   "compat6\' instead!");
             return 1;
         case 'o':
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 4/5 Spell "unkown" correctly in error_report() arguments

In reply to Markus Armbruster
---
 hw/lm32_sys.c          |    2 +-
 hw/lm32_timer.c        |    4 ++--
 hw/lm32_uart.c         |    4 ++--
 hw/milkymist-ac97.c    |    4 ++--
 hw/milkymist-memcard.c |    4 ++--
 hw/milkymist-sysctl.c  |    4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)
hw/lm32_sys.c +1 -1
index 427b05f..e5ff962 100644
@@ -83,7 +83,7 @@ static void sys_write(void *opaque, target_phys_addr_t addr, uint32_t value)
         break;
 
     default:
-        error_report("lm32_sys: write access to unkown register 0x"
+        error_report("lm32_sys: write access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
hw/lm32_timer.c +2 -2
index ed28984..49cbb22 100644
@@ -86,7 +86,7 @@ static uint32_t timer_read(void *opaque, target_phys_addr_t addr)
         r = (uint32_t)ptimer_get_count(s->ptimer);
         break;
     default:
-        error_report("lm32_timer: read access to unkown register 0x"
+        error_report("lm32_timer: read access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
@@ -124,7 +124,7 @@ static void timer_write(void *opaque, target_phys_addr_t addr, uint32_t value)
                 TARGET_FMT_plx, addr << 2);
         break;
     default:
-        error_report("lm32_timer: write access to unkown register 0x"
+        error_report("lm32_timer: write access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
hw/lm32_uart.c +2 -2
index e225087..09090e9 100644
@@ -149,7 +149,7 @@ static uint32_t uart_read(void *opaque, target_phys_addr_t addr)
                 TARGET_FMT_plx, addr << 2);
         break;
     default:
-        error_report("lm32_uart: read access to unkown register 0x"
+        error_report("lm32_uart: read access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
@@ -185,7 +185,7 @@ static void uart_write(void *opaque, target_phys_addr_t addr, uint32_t value)
                 TARGET_FMT_plx, addr << 2);
         break;
     default:
-        error_report("lm32_uart: write access to unkown register 0x"
+        error_report("lm32_uart: write access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
hw/milkymist-ac97.c +2 -2
index 6c9e318..6104732 100644
@@ -103,7 +103,7 @@ static uint32_t ac97_read(void *opaque, target_phys_addr_t addr)
         break;
 
     default:
-        error_report("milkymist_ac97: read access to unkown register 0x"
+        error_report("milkymist_ac97: read access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
@@ -152,7 +152,7 @@ static void ac97_write(void *opaque, target_phys_addr_t addr, uint32_t value)
         break;
 
     default:
-        error_report("milkymist_ac97: write access to unkown register 0x"
+        error_report("milkymist_ac97: write access to unknown register 0x"
                 TARGET_FMT_plx, addr);
         break;
     }
hw/milkymist-memcard.c +2 -2
index 06077af..22dc377 100644
@@ -154,7 +154,7 @@ static uint32_t memcard_read(void *opaque, target_phys_addr_t addr)
         break;
 
     default:
-        error_report("milkymist_memcard: read access to unkown register 0x"
+        error_report("milkymist_memcard: read access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
@@ -210,7 +210,7 @@ static void memcard_write(void *opaque, target_phys_addr_t addr, uint32_t value)
         break;
 
     default:
-        error_report("milkymist_memcard: write access to unkown register 0x"
+        error_report("milkymist_memcard: write access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
hw/milkymist-sysctl.c +2 -2
index 6bd0cb9..7b2d544 100644
@@ -119,7 +119,7 @@ static uint32_t sysctl_read(void *opaque, target_phys_addr_t addr)
         break;
 
     default:
-        error_report("milkymist_sysctl: read access to unkown register 0x"
+        error_report("milkymist_sysctl: read access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
@@ -189,7 +189,7 @@ static void sysctl_write(void *opaque, target_phys_addr_t addr, uint32_t value)
         break;
 
     default:
-        error_report("milkymist_sysctl: write access to unkown register 0x"
+        error_report("milkymist_sysctl: write access to unknown register 0x"
                 TARGET_FMT_plx, addr << 2);
         break;
     }
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/5 Strip trailing '\n' from error_report()'s first argument

In reply to Markus Armbruster

error_report() prepends location, and appends a newline. The message constructed from the arguments should not contain a newline. Fix the obvious offenders.

---
 block-migration.c       |    2 +-
 block/qcow2.c           |    2 +-
 block/sheepdog.c        |   84 +++++++++++++++++++++++-----------------------
 hw/milkymist-minimac2.c |    6 ++--
 hw/milkymist-pfpu.c     |    4 +-
 hw/milkymist-softusb.c  |    8 ++--
 hw/milkymist-tmu2.c     |    8 ++--
 hw/qdev.c               |    2 +-
 hw/strongarm.c          |    4 +-
 hw/usb-ccid.c           |    2 +-
 hw/virtio-serial-bus.c  |   10 +++---
 hw/virtio.c             |    4 +-
 net.c                   |    2 +-
 net/socket.c            |    6 ++--
 qemu-error.c            |    2 +
 qemu-img.c              |    4 +-
 16 files changed, 76 insertions(+), 74 deletions(-)
block-migration.c +1 -1
index 8d06a23..0936c7d 100644
@@ -671,7 +671,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
                 bs_prev = bs;
                 total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
                 if (total_sectors <= 0) {
-                    error_report("Error getting length of block device %s\n",
+                    error_report("Error getting length of block device %s",
                                  device_name);
                     return -EINVAL;
                 }
block/qcow2.c +1 -1
index 2c51e7c..48e1b95 100644
@@ -936,7 +936,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
         (1 << cluster_bits) != cluster_size)
     {
         error_report(
-            "Cluster size must be a power of two between %d and %dk\n",
+            "Cluster size must be a power of two between %d and %dk",
             1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10));
         return -EINVAL;
     }
block/sheepdog.c +42 -42

332 lines not on this page · raw message

hw/milkymist-minimac2.c +3 -3
index c4e2818..cd36026 100644
@@ -234,20 +234,20 @@ static void minimac2_tx(MilkymistMinimac2State *s)
     uint8_t *buf = s->tx_buf;
 
     if (txcount < 64) {
-        error_report("milkymist_minimac2: ethernet frame too small (%u < %u)\n",
+        error_report("milkymist_minimac2: ethernet frame too small (%u < %u)",
                 txcount, 64);
         goto err;
     }
 
     if (txcount > MINIMAC2_MTU) {
-        error_report("milkymist_minimac2: MTU exceeded (%u > %u)\n",
+        error_report("milkymist_minimac2: MTU exceeded (%u > %u)",
                 txcount, MINIMAC2_MTU);
         goto err;
     }
 
     if (memcmp(buf, preamble_sfd, 8) != 0) {
         error_report("milkymist_minimac2: frame doesn't contain the preamble "
-                "and/or the SFD (%02x %02x %02x %02x %02x %02x %02x %02x)\n",
+                "and/or the SFD (%02x %02x %02x %02x %02x %02x %02x %02x)",
                 buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
         goto err;
     }
hw/milkymist-pfpu.c +2 -2
index 94e6315..306d1ce 100644
@@ -301,7 +301,7 @@ static int pfpu_decode_insn(MilkymistPFPUState *s)
     } break;
 
     default:
-        error_report("milkymist_pfpu: unknown opcode %d\n", op);
+        error_report("milkymist_pfpu: unknown opcode %d", op);
         break;
     }
 
@@ -358,7 +358,7 @@ static void pfpu_start(MilkymistPFPUState *s)
                 /* decode at most MICROCODE_WORDS instructions */
                 if (i++ >= MICROCODE_WORDS) {
                     error_report("milkymist_pfpu: too many instructions "
-                            "executed in microcode. No VECTOUT?\n");
+                            "executed in microcode. No VECTOUT?");
                     break;
                 }
             }
hw/milkymist-softusb.c +4 -4
index 028f3b7..5ab35c3 100644
@@ -131,7 +131,7 @@ static inline void softusb_read_dmem(MilkymistSoftUsbState *s,
 {
     if (offset + len >= s->dmem_size) {
         error_report("milkymist_softusb: read dmem out of bounds "
-                "at offset 0x%x, len %d\n", offset, len);
+                "at offset 0x%x, len %d", offset, len);
         return;
     }
 
@@ -143,7 +143,7 @@ static inline void softusb_write_dmem(MilkymistSoftUsbState *s,
 {
     if (offset + len >= s->dmem_size) {
         error_report("milkymist_softusb: write dmem out of bounds "
-                "at offset 0x%x, len %d\n", offset, len);
+                "at offset 0x%x, len %d", offset, len);
         return;
     }
 
@@ -155,7 +155,7 @@ static inline void softusb_read_pmem(MilkymistSoftUsbState *s,
 {
     if (offset + len >= s->pmem_size) {
         error_report("milkymist_softusb: read pmem out of bounds "
-                "at offset 0x%x, len %d\n", offset, len);
+                "at offset 0x%x, len %d", offset, len);
         return;
     }
 
@@ -167,7 +167,7 @@ static inline void softusb_write_pmem(MilkymistSoftUsbState *s,
 {
     if (offset + len >= s->pmem_size) {
         error_report("milkymist_softusb: write pmem out of bounds "
-                "at offset 0x%x, len %d\n", offset, len);
+                "at offset 0x%x, len %d", offset, len);
         return;
     }
 
hw/milkymist-tmu2.c +4 -4
index 9cebe31..790cdcb 100644
@@ -352,21 +352,21 @@ static uint32_t tmu2_read(void *opaque, target_phys_addr_t addr)
 static void tmu2_check_registers(MilkymistTMU2State *s)
 {
     if (s->regs[R_BRIGHTNESS] > MAX_BRIGHTNESS) {
-        error_report("milkymist_tmu2: max brightness is %d\n", MAX_BRIGHTNESS);
+        error_report("milkymist_tmu2: max brightness is %d", MAX_BRIGHTNESS);
     }
 
     if (s->regs[R_ALPHA] > MAX_ALPHA) {
-        error_report("milkymist_tmu2: max alpha is %d\n", MAX_ALPHA);
+        error_report("milkymist_tmu2: max alpha is %d", MAX_ALPHA);
     }
 
     if (s->regs[R_VERTICESADDR] & 0x07) {
         error_report("milkymist_tmu2: vertex mesh address has to be 64-bit "
-                "aligned\n");
+                "aligned");
     }
 
     if (s->regs[R_TEXFBUF] & 0x01) {
         error_report("milkymist_tmu2: texture buffer address has to be "
-                "16-bit aligned\n");
+                "16-bit aligned");
     }
 }
 
hw/qdev.c +1 -1
index 9519f5d..0fd27d5 100644
@@ -371,7 +371,7 @@ void qdev_init_nofail(DeviceState *dev)
     DeviceInfo *info = dev->info;
 
     if (qdev_init(dev) < 0) {
-        error_report("Initialization of device %s failed\n", info->name);
+        error_report("Initialization of device %s failed", info->name);
         exit(1);
     }
 }
hw/strongarm.c +2 -2
index de08bdf..0e03d61 100644
@@ -1536,14 +1536,14 @@ StrongARMState *sa1110_init(unsigned int sdram_size, const char *rev)
     }
 
     if (strncmp(rev, "sa1110", 6)) {
-        error_report("Machine requires a SA1110 processor.\n");
+        error_report("Machine requires a SA1110 processor.");
         exit(1);
     }
 
     s->env = cpu_init(rev);
 
     if (!s->env) {
-        error_report("Unable to find CPU definition\n");
+        error_report("Unable to find CPU definition");
         exit(1);
     }
 
hw/usb-ccid.c +1 -1
index 59c6431..524b841 100644
@@ -1240,7 +1240,7 @@ static int ccid_card_init(DeviceState *qdev, DeviceInfo *base)
         return -1;
     }
     if (s->card != NULL) {
-        error_report("Warning: usb-ccid card already full, not adding\n");
+        error_report("Warning: usb-ccid card already full, not adding");
         return -1;
     }
     ret = info->initfn ? info->initfn(card) : ret;
hw/virtio-serial-bus.c +5 -5
index 9a12104..bff4004 100644
@@ -337,7 +337,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
     switch(cpkt.event) {
     case VIRTIO_CONSOLE_DEVICE_READY:
         if (!cpkt.value) {
-            error_report("virtio-serial-bus: Guest failure in adding device %s\n",
+            error_report("virtio-serial-bus: Guest failure in adding device %s",
                          vser->bus.qbus.name);
             break;
         }
@@ -352,7 +352,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
 
     case VIRTIO_CONSOLE_PORT_READY:
         if (!cpkt.value) {
-            error_report("virtio-serial-bus: Guest failure in adding port %u for device %s\n",
+            error_report("virtio-serial-bus: Guest failure in adding port %u for device %s",
                          port->id, vser->bus.qbus.name);
             break;
         }
@@ -741,7 +741,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
     plugging_port0 = info->is_console && !find_port_by_id(port->vser, 0);
 
     if (find_port_by_id(port->vser, port->id)) {
-        error_report("virtio-serial-bus: A port already exists at id %u\n",
+        error_report("virtio-serial-bus: A port already exists at id %u",
                      port->id);
         return -1;
     }
@@ -752,7 +752,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
         } else {
             port->id = find_free_port_id(port->vser);
             if (port->id == VIRTIO_CONSOLE_BAD_ID) {
-                error_report("virtio-serial-bus: Maximum port limit for this device reached\n");
+                error_report("virtio-serial-bus: Maximum port limit for this device reached");
                 return -1;
             }
         }
@@ -760,7 +760,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
 
     max_nr_ports = tswap32(port->vser->config.max_nr_ports);
     if (port->id >= max_nr_ports) {
-        error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n",
+        error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u",
                      max_nr_ports - 1);
         return -1;
     }
hw/virtio.c +2 -2
index 6e8814c..096adce 100644
@@ -725,7 +725,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
             /* Check it isn't doing very strange things with descriptor numbers. */
             if (nheads > vdev->vq[i].vring.num) {
                 error_report("VQ %d size 0x%x Guest index 0x%x "
-                             "inconsistent with Host index 0x%x: delta 0x%x\n",
+                             "inconsistent with Host index 0x%x: delta 0x%x",
                              i, vdev->vq[i].vring.num,
                              vring_avail_idx(&vdev->vq[i]),
                              vdev->vq[i].last_avail_idx, nheads);
@@ -733,7 +733,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
             }
         } else if (vdev->vq[i].last_avail_idx) {
             error_report("VQ %d address 0x0 "
-                         "inconsistent with Host index 0x%x\n",
+                         "inconsistent with Host index 0x%x",
                          i, vdev->vq[i].last_avail_idx);
                 return -1;
 	}
net.c +1 -1
index 4f777c3..8f7199c 100644
@@ -710,7 +710,7 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models,
             return i;
     }
 
-    error_report("qemu: Unsupported NIC model: %s", nd->model);
+    error_report("Unsupported NIC model: %s", nd->model);
     return -1;
 }
 
net/socket.c +3 -3
index 7337f4f..bc1bf58 100644
@@ -530,7 +530,7 @@ int net_init_socket(QemuOpts *opts,
             qemu_opt_get(opts, "connect") ||
             qemu_opt_get(opts, "mcast") ||
             qemu_opt_get(opts, "localaddr")) {
-            error_report("listen=, connect=, mcast= and localaddr= is invalid with fd=\n");
+            error_report("listen=, connect=, mcast= and localaddr= is invalid with fd=");
             return -1;
         }
 
@@ -550,7 +550,7 @@ int net_init_socket(QemuOpts *opts,
             qemu_opt_get(opts, "connect") ||
             qemu_opt_get(opts, "mcast") ||
             qemu_opt_get(opts, "localaddr")) {
-            error_report("fd=, connect=, mcast= and localaddr= is invalid with listen=\n");
+            error_report("fd=, connect=, mcast= and localaddr= is invalid with listen=");
             return -1;
         }
 
@@ -566,7 +566,7 @@ int net_init_socket(QemuOpts *opts,
             qemu_opt_get(opts, "listen") ||
             qemu_opt_get(opts, "mcast") ||
             qemu_opt_get(opts, "localaddr")) {
-            error_report("fd=, listen=, mcast= and localaddr= is invalid with connect=\n");
+            error_report("fd=, listen=, mcast= and localaddr= is invalid with connect=");
             return -1;
         }
 
qemu-error.c +2 -0
index 41c191d..4b20d28 100644
@@ -193,6 +193,8 @@ void error_print_loc(void)
 
 /*
  * Print an error message to current monitor if we have one, else to stderr.
+ * Format arguments like sprintf().  The result should not contain
+ * newlines.
  * Prepend the current location and append a newline.
  * It's wrong to call this in a QMP monitor.  Use qerror_report() there.
  */
qemu-img.c +2 -2
index 4f162d1..1a37828 100644
@@ -690,12 +690,12 @@ static int img_convert(int argc, char **argv)
 
     if (snapshot_name != NULL) {
         if (bs_n > 1) {
-            error_report("No support for concatenating multiple snapshot\n");
+            error_report("No support for concatenating multiple snapshot");
             ret = -1;
             goto out;
         }
         if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) {
-            error_report("Failed to load snapshot\n");
+            error_report("Failed to load snapshot");
             ret = -1;
             goto out;
         }
Signature · 1 line
1.7.2.3
Acked-by on the v1 series
#6 lore raw
In reply to Markus Armbruster
Quoted 8 lines · Markus Armbruster

I limited myself to truly trivial fixes. I hope that's still useful enough to excuse a little rant.

"bug: 0 0" is not a useful error message. Neither are "Desc next is 128", " too short" (too short indeed), "wrong magic" (some "wrong magic" skills will be handy to figure out what went wrong). I'm stopping here for brevity's sake, not for want of examples.

Quoted 4 lines

If you can't be bothered to provide an intelligible error message and *test* it to verify it actually makes sense for the user, maybe you should stick to assert() or something. Makes your laziness stand out properly.

Regards,

Anthony Liguori

Quoted 33 lines

Markus Armbruster (5):
sheepdog: qemu_bh_new() can't return null pointer, drop check Strip trailing '\n' from error_report()'s first argument
qemu-img: Don't prepend qemu-img to error messages twice. Spell "unkown" correctly in error_report() arguments
blockdev: Put space after comma in error message

  block-migration.c       |    2 +-
  block/qcow2.c           |    2 +-
  block/sheepdog.c        |   90 ++++++++++++++++++++++-------------------------
  blockdev.c              |    2 +-
  hw/lm32_sys.c           |    2 +-
  hw/lm32_timer.c         |    4 +-
  hw/lm32_uart.c          |    4 +-
  hw/milkymist-ac97.c     |    4 +-
  hw/milkymist-memcard.c  |    4 +-
  hw/milkymist-minimac2.c |    6 ++--
  hw/milkymist-pfpu.c     |    4 +-
  hw/milkymist-softusb.c  |    8 ++--
  hw/milkymist-sysctl.c   |    4 +-
  hw/milkymist-tmu2.c     |    8 ++--
  hw/qdev.c               |    2 +-
  hw/strongarm.c          |    4 +-
  hw/usb-ccid.c           |    2 +-
  hw/virtio-serial-bus.c  |   10 +++---
  hw/virtio.c             |    4 +-
  net.c                   |    2 +-
  net/socket.c            |    6 ++--
  qemu-error.c            |    2 +
  qemu-img.c              |   12 +++---
  23 files changed, 92 insertions(+), 96 deletions(-)
#7 lore raw
In reply to Markus Armbruster
Quoted 36 lines · Markus Armbruster

I limited myself to truly trivial fixes. I hope that's still useful enough to excuse a little rant.

"bug: 0 0" is not a useful error message. Neither are "Desc next is 128", " too short" (too short indeed), "wrong magic" (some "wrong magic" skills will be handy to figure out what went wrong). I'm stopping here for brevity's sake, not for want of examples.

If you can't be bothered to provide an intelligible error message and *test* it to verify it actually makes sense for the user, maybe you should stick to assert() or something. Makes your laziness stand out properly.

Markus Armbruster (5):
sheepdog: qemu_bh_new() can't return null pointer, drop check Strip trailing '\n' from error_report()'s first argument
qemu-img: Don't prepend qemu-img to error messages twice. Spell "unkown" correctly in error_report() arguments
blockdev: Put space after comma in error message

 block-migration.c       |    2 +-
 block/qcow2.c           |    2 +-
 block/sheepdog.c        |   90 ++++++++++++++++++++++-------------------------
 blockdev.c              |    2 +-
 hw/lm32_sys.c           |    2 +-
 hw/lm32_timer.c         |    4 +-
 hw/lm32_uart.c          |    4 +-
 hw/milkymist-ac97.c     |    4 +-
 hw/milkymist-memcard.c  |    4 +-
 hw/milkymist-minimac2.c |    6 ++--
 hw/milkymist-pfpu.c     |    4 +-
 hw/milkymist-softusb.c  |    8 ++--
 hw/milkymist-sysctl.c   |    4 +-
 hw/milkymist-tmu2.c     |    8 ++--
 hw/qdev.c               |    2 +-
 hw/strongarm.c          |    4 +-
Quoted 8 lines
 hw/usb-ccid.c           |    2 +-
 hw/virtio-serial-bus.c  |   10 +++---
 hw/virtio.c             |    4 +-
 net.c                   |    2 +-
 net/socket.c            |    6 ++--
 qemu-error.c            |    2 +
 qemu-img.c              |   12 +++---
 23 files changed, 92 insertions(+), 96 deletions(-)

Thanks, applied to trivial-patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan