diff mbox

[1/4] error: Strip trailing '\n' from error string arguments (again)

Message ID 1449768232-22924-2-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Dec. 10, 2015, 5:23 p.m. UTC
Commit 6daf194d, be62a2eb and 312fd5f got rid of a bunch, but they
keep coming back.  Tracked down with the Coccinelle semantic patch
from commit 312fd5f.

Cc: Fam Zheng <famz@redhat.com>
Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>
Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: Changchun Ouyang <changchun.ouyang@intel.com>
Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>
Cc: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/vmdk.c              |  4 ++--
 hw/arm/xlnx-zynqmp.c      |  2 +-
 hw/ppc/spapr.c            |  3 ++-
 hw/s390x/ipl.c            |  8 ++++----
 hw/s390x/s390-skeys-kvm.c |  2 +-
 hw/s390x/s390-skeys.c     | 16 ++++++++--------
 hw/tpm/tpm_tis.c          |  2 +-
 migration/ram.c           |  2 +-
 migration/savevm.c        |  4 ++--
 net/vhost-user.c          |  6 +++---
 qga/commands-posix.c      |  2 +-
 target-arm/cpu.c          |  2 +-
 target-arm/machine.c      |  4 ++--
 13 files changed, 29 insertions(+), 28 deletions(-)

Comments

Dr. David Alan Gilbert Dec. 10, 2015, 5:31 p.m. UTC | #1
* Markus Armbruster (armbru@redhat.com) wrote:
> Commit 6daf194d, be62a2eb and 312fd5f got rid of a bunch, but they
> keep coming back.  Tracked down with the Coccinelle semantic patch
> from commit 312fd5f.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> Cc: Fam Zheng <famz@redhat.com>
> Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>
> Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>
> Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
> Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: Changchun Ouyang <changchun.ouyang@intel.com>
> Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Cc: Pavel Fedin <p.fedin@samsung.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block/vmdk.c              |  4 ++--
>  hw/arm/xlnx-zynqmp.c      |  2 +-
>  hw/ppc/spapr.c            |  3 ++-
>  hw/s390x/ipl.c            |  8 ++++----
>  hw/s390x/s390-skeys-kvm.c |  2 +-
>  hw/s390x/s390-skeys.c     | 16 ++++++++--------
>  hw/tpm/tpm_tis.c          |  2 +-
>  migration/ram.c           |  2 +-
>  migration/savevm.c        |  4 ++--
>  net/vhost-user.c          |  6 +++---
>  qga/commands-posix.c      |  2 +-
>  target-arm/cpu.c          |  2 +-
>  target-arm/machine.c      |  4 ++--
>  13 files changed, 29 insertions(+), 28 deletions(-)
> 
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 6f819e4..b4a224e 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1494,8 +1494,8 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
>  
>      if (sector_num > bs->total_sectors) {
>          error_report("Wrong offset: sector_num=0x%" PRIx64
> -                " total_sectors=0x%" PRIx64 "\n",
> -                sector_num, bs->total_sectors);
> +                     " total_sectors=0x%" PRIx64,
> +                     sector_num, bs->total_sectors);
>          return -EIO;
>      }
>  
> diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
> index 87553bb..20a3b2b 100644
> --- a/hw/arm/xlnx-zynqmp.c
> +++ b/hw/arm/xlnx-zynqmp.c
> @@ -227,7 +227,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
>      }
>  
>      if (!s->boot_cpu_ptr) {
> -        error_setg(errp, "ZynqMP Boot cpu %s not found\n", boot_cpu);
> +        error_setg(errp, "ZynqMP Boot cpu %s not found", boot_cpu);
>          return;
>      }
>  
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 6bfb908..6ba68d7 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1831,7 +1831,8 @@ static void ppc_spapr_init(MachineState *machine)
>          ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size;
>  
>          if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) {
> -            error_report("Specified number of memory slots %"PRIu64" exceeds max supported %d\n",
> +            error_report("Specified number of memory slots %" PRIu64
> +                         " exceeds max supported %d",
>                           machine->ram_slots, SPAPR_MAX_RAM_SLOTS);
>              exit(EXIT_FAILURE);
>          }
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index b91fcc6..e100428 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -94,7 +94,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>  
>          bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>          if (bios_filename == NULL) {
> -            error_setg(&l_err, "could not find stage1 bootloader\n");
> +            error_setg(&l_err, "could not find stage1 bootloader");
>              goto error;
>          }
>  
> @@ -113,7 +113,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>          g_free(bios_filename);
>  
>          if (bios_size == -1) {
> -            error_setg(&l_err, "could not load bootloader '%s'\n", bios_name);
> +            error_setg(&l_err, "could not load bootloader '%s'", bios_name);
>              goto error;
>          }
>  
> @@ -128,7 +128,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>              kernel_size = load_image_targphys(ipl->kernel, 0, ram_size);
>          }
>          if (kernel_size < 0) {
> -            error_setg(&l_err, "could not load kernel '%s'\n", ipl->kernel);
> +            error_setg(&l_err, "could not load kernel '%s'", ipl->kernel);
>              goto error;
>          }
>          /*
> @@ -156,7 +156,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>              initrd_size = load_image_targphys(ipl->initrd, initrd_offset,
>                                                ram_size - initrd_offset);
>              if (initrd_size == -1) {
> -                error_setg(&l_err, "could not load initrd '%s'\n", ipl->initrd);
> +                error_setg(&l_err, "could not load initrd '%s'", ipl->initrd);
>                  goto error;
>              }
>  
> diff --git a/hw/s390x/s390-skeys-kvm.c b/hw/s390x/s390-skeys-kvm.c
> index 682949a..eaa37ba 100644
> --- a/hw/s390x/s390-skeys-kvm.c
> +++ b/hw/s390x/s390-skeys-kvm.c
> @@ -21,7 +21,7 @@ static int kvm_s390_skeys_enabled(S390SKeysState *ss)
>  
>      r = skeyclass->get_skeys(ss, 0, 1, &single_key);
>      if (r != 0 && r != KVM_S390_GET_SKEYS_NONE) {
> -        error_report("S390_GET_KEYS error %d\n", r);
> +        error_report("S390_GET_KEYS error %d", r);
>      }
>      return (r == 0);
>  }
> diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
> index 539ef6d..c9acc18 100644
> --- a/hw/s390x/s390-skeys.c
> +++ b/hw/s390x/s390-skeys.c
> @@ -192,8 +192,8 @@ static int qemu_s390_skeys_set(S390SKeysState *ss, uint64_t start_gfn,
>      /* Check for uint64 overflow and access beyond end of key data */
>      if (start_gfn + count > skeydev->key_count || start_gfn + count < count) {
>          error_report("Error: Setting storage keys for page beyond the end "
> -                "of memory: gfn=%" PRIx64 " count=%" PRId64 "\n", start_gfn,
> -                count);
> +                     "of memory: gfn=%" PRIx64 " count=%" PRId64,
> +                     start_gfn, count);
>          return -EINVAL;
>      }
>  
> @@ -212,8 +212,8 @@ static int qemu_s390_skeys_get(S390SKeysState *ss, uint64_t start_gfn,
>      /* Check for uint64 overflow and access beyond end of key data */
>      if (start_gfn + count > skeydev->key_count || start_gfn + count < count) {
>          error_report("Error: Getting storage keys for page beyond the end "
> -                "of memory: gfn=%" PRIx64 " count=%" PRId64 "\n", start_gfn,
> -                count);
> +                     "of memory: gfn=%" PRIx64 " count=%" PRId64,
> +                     start_gfn, count);
>          return -EINVAL;
>      }
>  
> @@ -257,7 +257,7 @@ static void s390_storage_keys_save(QEMUFile *f, void *opaque)
>  
>      buf = g_try_malloc(S390_SKEYS_BUFFER_SIZE);
>      if (!buf) {
> -        error_report("storage key save could not allocate memory\n");
> +        error_report("storage key save could not allocate memory");
>          goto end_stream;
>      }
>  
> @@ -277,7 +277,7 @@ static void s390_storage_keys_save(QEMUFile *f, void *opaque)
>                   * use S390_SKEYS_SAVE_FLAG_ERROR to indicate failure to the
>                   * reading side.
>                   */
> -                error_report("S390_GET_KEYS error %d\n", error);
> +                error_report("S390_GET_KEYS error %d", error);
>                  memset(buf, 0, S390_SKEYS_BUFFER_SIZE);
>                  eos = S390_SKEYS_SAVE_FLAG_ERROR;
>              }
> @@ -315,7 +315,7 @@ static int s390_storage_keys_load(QEMUFile *f, void *opaque, int version_id)
>              uint8_t *buf = g_try_malloc(S390_SKEYS_BUFFER_SIZE);
>  
>              if (!buf) {
> -                error_report("storage key load could not allocate memory\n");
> +                error_report("storage key load could not allocate memory");
>                  ret = -ENOMEM;
>                  break;
>              }
> @@ -327,7 +327,7 @@ static int s390_storage_keys_load(QEMUFile *f, void *opaque, int version_id)
>  
>                  ret = skeyclass->set_skeys(ss, cur_gfn, cur_count, buf);
>                  if (ret < 0) {
> -                    error_report("S390_SET_KEYS error %d\n", ret);
> +                    error_report("S390_SET_KEYS error %d", ret);
>                      break;
>                  }
>                  handled_count += cur_count;
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index ff073d5..95fc66e 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -1051,7 +1051,7 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
>  
>      if (tis->irq_num > 15) {
>          error_setg(errp, "tpm_tis: IRQ %d for TPM TIS is outside valid range "
> -                   "of 0 to 15.\n", tis->irq_num);
> +                   "of 0 to 15", tis->irq_num);
>          return;
>      }
>  
> diff --git a/migration/ram.c b/migration/ram.c
> index 1eb155a..d1611cb 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -2314,7 +2314,7 @@ static int ram_load_postcopy(QEMUFile *f)
>              } else {
>                  /* not the 1st TP within the HP */
>                  if (host != (last_host + TARGET_PAGE_SIZE)) {
> -                    error_report("Non-sequential target page %p/%p\n",
> +                    error_report("Non-sequential target page %p/%p",
>                                    host, last_host);
>                      ret = -EINVAL;
>                      break;
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 0ad1b93..f7d12e1 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1563,8 +1563,8 @@ static int loadvm_handle_cmd_packaged(MigrationIncomingState *mis)
>      ret = qemu_get_buffer(mis->from_src_file, buffer, (int)length);
>      if (ret != length) {
>          g_free(buffer);
> -        error_report("CMD_PACKAGED: Buffer receive fail ret=%d length=%d\n",
> -                ret, length);
> +        error_report("CMD_PACKAGED: Buffer receive fail ret=%d length=%d",
> +                     ret, length);
>          return (ret < 0) ? ret : -EAGAIN;
>      }
>      trace_loadvm_handle_cmd_packaged_received(ret);
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index b368a90..e4dd089 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -82,15 +82,15 @@ static int vhost_user_start(int queues, NetClientState *ncs[])
>          options.opaque      = s->chr;
>          s->vhost_net = vhost_net_init(&options);
>          if (!s->vhost_net) {
> -            error_report("failed to init vhost_net for queue %d\n", i);
> +            error_report("failed to init vhost_net for queue %d", i);
>              goto err;
>          }
>  
>          if (i == 0) {
>              max_queues = vhost_net_get_max_queues(s->vhost_net);
>              if (queues > max_queues) {
> -                error_report("you are asking more queues than "
> -                             "supported: %d\n", max_queues);
> +                error_report("you are asking more queues than supported: %d",
> +                             max_queues);
>                  goto err;
>              }
>          }
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index c2ff970..ec0e997 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -2247,7 +2247,7 @@ GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
>           */
>          if (errno != ENOENT) {
>              error_setg_errno(errp, errno, "Can't open directory"
> -                             "\"/sys/devices/system/memory/\"\n");
> +                             "\"/sys/devices/system/memory/\"");
>          }
>          return NULL;
>      }
> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> index 30739fc..cac27f9 100644
> --- a/target-arm/cpu.c
> +++ b/target-arm/cpu.c
> @@ -649,7 +649,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
>          uint32_t nr = cpu->pmsav7_dregion;
>  
>          if (nr > 0xff) {
> -            error_setg(errp, "PMSAv7 MPU #regions invalid %" PRIu32 "\n", nr);
> +            error_setg(errp, "PMSAv7 MPU #regions invalid %" PRIu32, nr);
>              return;
>          }
>  
> diff --git a/target-arm/machine.c b/target-arm/machine.c
> index 36a0d15..b1e1418 100644
> --- a/target-arm/machine.c
> +++ b/target-arm/machine.c
> @@ -337,11 +337,11 @@ const char *gicv3_class_name(void)
>          return "kvm-arm-gicv3";
>  #else
>          error_report("KVM GICv3 acceleration is not supported on this "
> -                     "platform\n");
> +                     "platform");
>  #endif
>      } else {
>          /* TODO: Software emulation is not implemented yet */
> -        error_report("KVM is currently required for GICv3 emulation\n");
> +        error_report("KVM is currently required for GICv3 emulation");
>      }
>  
>      exit(1);
> -- 
> 2.4.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Cornelia Huck Dec. 10, 2015, 6:16 p.m. UTC | #2
On Thu, 10 Dec 2015 18:23:49 +0100
Markus Armbruster <armbru@redhat.com> wrote:

> Commit 6daf194d, be62a2eb and 312fd5f got rid of a bunch, but they
> keep coming back.  Tracked down with the Coccinelle semantic patch
> from commit 312fd5f.
> 
> Cc: Fam Zheng <famz@redhat.com>
> Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>
> Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>
> Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
> Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: Changchun Ouyang <changchun.ouyang@intel.com>
> Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Cc: Pavel Fedin <p.fedin@samsung.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block/vmdk.c              |  4 ++--
>  hw/arm/xlnx-zynqmp.c      |  2 +-
>  hw/ppc/spapr.c            |  3 ++-
>  hw/s390x/ipl.c            |  8 ++++----
>  hw/s390x/s390-skeys-kvm.c |  2 +-
>  hw/s390x/s390-skeys.c     | 16 ++++++++--------
>  hw/tpm/tpm_tis.c          |  2 +-
>  migration/ram.c           |  2 +-
>  migration/savevm.c        |  4 ++--
>  net/vhost-user.c          |  6 +++---
>  qga/commands-posix.c      |  2 +-
>  target-arm/cpu.c          |  2 +-
>  target-arm/machine.c      |  4 ++--
>  13 files changed, 29 insertions(+), 28 deletions(-)
> 

s390x parts:

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>

Can somebody with Perl-fu extend checkpatch.pl if these keep coming
back?
Bharata B Rao Dec. 11, 2015, 3:09 a.m. UTC | #3
On Thu, Dec 10, 2015 at 06:23:49PM +0100, Markus Armbruster wrote:
> Commit 6daf194d, be62a2eb and 312fd5f got rid of a bunch, but they
> keep coming back.  Tracked down with the Coccinelle semantic patch
> from commit 312fd5f.
> 
> Cc: Fam Zheng <famz@redhat.com>
> Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>
> Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>
> Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
> Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Cc: Changchun Ouyang <changchun.ouyang@intel.com>
> Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>
> Cc: Pavel Fedin <p.fedin@samsung.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block/vmdk.c              |  4 ++--
>  hw/arm/xlnx-zynqmp.c      |  2 +-
>  hw/ppc/spapr.c            |  3 ++-

For spapr bits, Acked-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Fam Zheng Dec. 11, 2015, 5:26 a.m. UTC | #4
On Thu, 12/10 18:23, Markus Armbruster wrote:
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 6f819e4..b4a224e 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1494,8 +1494,8 @@ static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
>  
>      if (sector_num > bs->total_sectors) {
>          error_report("Wrong offset: sector_num=0x%" PRIx64
> -                " total_sectors=0x%" PRIx64 "\n",
> -                sector_num, bs->total_sectors);
> +                     " total_sectors=0x%" PRIx64,
> +                     sector_num, bs->total_sectors);
>          return -EIO;
>      }
>  

For VMDK change:

Acked-by: Fam Zheng <famz@redhat.com>
Zhanghailiang Dec. 11, 2015, 9:01 a.m. UTC | #5
On 2015/12/11 2:16, Cornelia Huck wrote:
> On Thu, 10 Dec 2015 18:23:49 +0100
> Markus Armbruster <armbru@redhat.com> wrote:
>
>> Commit 6daf194d, be62a2eb and 312fd5f got rid of a bunch, but they
>> keep coming back.  Tracked down with the Coccinelle semantic patch
>> from commit 312fd5f.
>>
>> Cc: Fam Zheng <famz@redhat.com>
>> Cc: Peter Crosthwaite <crosthwaitepeter@gmail.com>
>> Cc: Bharata B Rao <bharata@linux.vnet.ibm.com>
>> Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>
>> Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
>> Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
>> Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
>> Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> Cc: Changchun Ouyang <changchun.ouyang@intel.com>
>> Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>
>> Cc: Pavel Fedin <p.fedin@samsung.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>   block/vmdk.c              |  4 ++--
>>   hw/arm/xlnx-zynqmp.c      |  2 +-
>>   hw/ppc/spapr.c            |  3 ++-
>>   hw/s390x/ipl.c            |  8 ++++----
>>   hw/s390x/s390-skeys-kvm.c |  2 +-
>>   hw/s390x/s390-skeys.c     | 16 ++++++++--------
>>   hw/tpm/tpm_tis.c          |  2 +-
>>   migration/ram.c           |  2 +-
>>   migration/savevm.c        |  4 ++--
>>   net/vhost-user.c          |  6 +++---
>>   qga/commands-posix.c      |  2 +-
>>   target-arm/cpu.c          |  2 +-
>>   target-arm/machine.c      |  4 ++--
>>   13 files changed, 29 insertions(+), 28 deletions(-)
>>
>
> s390x parts:
>
> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>
> Can somebody with Perl-fu extend checkpatch.pl if these keep coming
> back?
>
>

Ha, that's really a good idea ...

> .
>
diff mbox

Patch

diff --git a/block/vmdk.c b/block/vmdk.c
index 6f819e4..b4a224e 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1494,8 +1494,8 @@  static int vmdk_write(BlockDriverState *bs, int64_t sector_num,
 
     if (sector_num > bs->total_sectors) {
         error_report("Wrong offset: sector_num=0x%" PRIx64
-                " total_sectors=0x%" PRIx64 "\n",
-                sector_num, bs->total_sectors);
+                     " total_sectors=0x%" PRIx64,
+                     sector_num, bs->total_sectors);
         return -EIO;
     }
 
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
index 87553bb..20a3b2b 100644
--- a/hw/arm/xlnx-zynqmp.c
+++ b/hw/arm/xlnx-zynqmp.c
@@ -227,7 +227,7 @@  static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
     }
 
     if (!s->boot_cpu_ptr) {
-        error_setg(errp, "ZynqMP Boot cpu %s not found\n", boot_cpu);
+        error_setg(errp, "ZynqMP Boot cpu %s not found", boot_cpu);
         return;
     }
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6bfb908..6ba68d7 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1831,7 +1831,8 @@  static void ppc_spapr_init(MachineState *machine)
         ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size;
 
         if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) {
-            error_report("Specified number of memory slots %"PRIu64" exceeds max supported %d\n",
+            error_report("Specified number of memory slots %" PRIu64
+                         " exceeds max supported %d",
                          machine->ram_slots, SPAPR_MAX_RAM_SLOTS);
             exit(EXIT_FAILURE);
         }
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index b91fcc6..e100428 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -94,7 +94,7 @@  static void s390_ipl_realize(DeviceState *dev, Error **errp)
 
         bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         if (bios_filename == NULL) {
-            error_setg(&l_err, "could not find stage1 bootloader\n");
+            error_setg(&l_err, "could not find stage1 bootloader");
             goto error;
         }
 
@@ -113,7 +113,7 @@  static void s390_ipl_realize(DeviceState *dev, Error **errp)
         g_free(bios_filename);
 
         if (bios_size == -1) {
-            error_setg(&l_err, "could not load bootloader '%s'\n", bios_name);
+            error_setg(&l_err, "could not load bootloader '%s'", bios_name);
             goto error;
         }
 
@@ -128,7 +128,7 @@  static void s390_ipl_realize(DeviceState *dev, Error **errp)
             kernel_size = load_image_targphys(ipl->kernel, 0, ram_size);
         }
         if (kernel_size < 0) {
-            error_setg(&l_err, "could not load kernel '%s'\n", ipl->kernel);
+            error_setg(&l_err, "could not load kernel '%s'", ipl->kernel);
             goto error;
         }
         /*
@@ -156,7 +156,7 @@  static void s390_ipl_realize(DeviceState *dev, Error **errp)
             initrd_size = load_image_targphys(ipl->initrd, initrd_offset,
                                               ram_size - initrd_offset);
             if (initrd_size == -1) {
-                error_setg(&l_err, "could not load initrd '%s'\n", ipl->initrd);
+                error_setg(&l_err, "could not load initrd '%s'", ipl->initrd);
                 goto error;
             }
 
diff --git a/hw/s390x/s390-skeys-kvm.c b/hw/s390x/s390-skeys-kvm.c
index 682949a..eaa37ba 100644
--- a/hw/s390x/s390-skeys-kvm.c
+++ b/hw/s390x/s390-skeys-kvm.c
@@ -21,7 +21,7 @@  static int kvm_s390_skeys_enabled(S390SKeysState *ss)
 
     r = skeyclass->get_skeys(ss, 0, 1, &single_key);
     if (r != 0 && r != KVM_S390_GET_SKEYS_NONE) {
-        error_report("S390_GET_KEYS error %d\n", r);
+        error_report("S390_GET_KEYS error %d", r);
     }
     return (r == 0);
 }
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index 539ef6d..c9acc18 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -192,8 +192,8 @@  static int qemu_s390_skeys_set(S390SKeysState *ss, uint64_t start_gfn,
     /* Check for uint64 overflow and access beyond end of key data */
     if (start_gfn + count > skeydev->key_count || start_gfn + count < count) {
         error_report("Error: Setting storage keys for page beyond the end "
-                "of memory: gfn=%" PRIx64 " count=%" PRId64 "\n", start_gfn,
-                count);
+                     "of memory: gfn=%" PRIx64 " count=%" PRId64,
+                     start_gfn, count);
         return -EINVAL;
     }
 
@@ -212,8 +212,8 @@  static int qemu_s390_skeys_get(S390SKeysState *ss, uint64_t start_gfn,
     /* Check for uint64 overflow and access beyond end of key data */
     if (start_gfn + count > skeydev->key_count || start_gfn + count < count) {
         error_report("Error: Getting storage keys for page beyond the end "
-                "of memory: gfn=%" PRIx64 " count=%" PRId64 "\n", start_gfn,
-                count);
+                     "of memory: gfn=%" PRIx64 " count=%" PRId64,
+                     start_gfn, count);
         return -EINVAL;
     }
 
@@ -257,7 +257,7 @@  static void s390_storage_keys_save(QEMUFile *f, void *opaque)
 
     buf = g_try_malloc(S390_SKEYS_BUFFER_SIZE);
     if (!buf) {
-        error_report("storage key save could not allocate memory\n");
+        error_report("storage key save could not allocate memory");
         goto end_stream;
     }
 
@@ -277,7 +277,7 @@  static void s390_storage_keys_save(QEMUFile *f, void *opaque)
                  * use S390_SKEYS_SAVE_FLAG_ERROR to indicate failure to the
                  * reading side.
                  */
-                error_report("S390_GET_KEYS error %d\n", error);
+                error_report("S390_GET_KEYS error %d", error);
                 memset(buf, 0, S390_SKEYS_BUFFER_SIZE);
                 eos = S390_SKEYS_SAVE_FLAG_ERROR;
             }
@@ -315,7 +315,7 @@  static int s390_storage_keys_load(QEMUFile *f, void *opaque, int version_id)
             uint8_t *buf = g_try_malloc(S390_SKEYS_BUFFER_SIZE);
 
             if (!buf) {
-                error_report("storage key load could not allocate memory\n");
+                error_report("storage key load could not allocate memory");
                 ret = -ENOMEM;
                 break;
             }
@@ -327,7 +327,7 @@  static int s390_storage_keys_load(QEMUFile *f, void *opaque, int version_id)
 
                 ret = skeyclass->set_skeys(ss, cur_gfn, cur_count, buf);
                 if (ret < 0) {
-                    error_report("S390_SET_KEYS error %d\n", ret);
+                    error_report("S390_SET_KEYS error %d", ret);
                     break;
                 }
                 handled_count += cur_count;
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index ff073d5..95fc66e 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -1051,7 +1051,7 @@  static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
 
     if (tis->irq_num > 15) {
         error_setg(errp, "tpm_tis: IRQ %d for TPM TIS is outside valid range "
-                   "of 0 to 15.\n", tis->irq_num);
+                   "of 0 to 15", tis->irq_num);
         return;
     }
 
diff --git a/migration/ram.c b/migration/ram.c
index 1eb155a..d1611cb 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2314,7 +2314,7 @@  static int ram_load_postcopy(QEMUFile *f)
             } else {
                 /* not the 1st TP within the HP */
                 if (host != (last_host + TARGET_PAGE_SIZE)) {
-                    error_report("Non-sequential target page %p/%p\n",
+                    error_report("Non-sequential target page %p/%p",
                                   host, last_host);
                     ret = -EINVAL;
                     break;
diff --git a/migration/savevm.c b/migration/savevm.c
index 0ad1b93..f7d12e1 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1563,8 +1563,8 @@  static int loadvm_handle_cmd_packaged(MigrationIncomingState *mis)
     ret = qemu_get_buffer(mis->from_src_file, buffer, (int)length);
     if (ret != length) {
         g_free(buffer);
-        error_report("CMD_PACKAGED: Buffer receive fail ret=%d length=%d\n",
-                ret, length);
+        error_report("CMD_PACKAGED: Buffer receive fail ret=%d length=%d",
+                     ret, length);
         return (ret < 0) ? ret : -EAGAIN;
     }
     trace_loadvm_handle_cmd_packaged_received(ret);
diff --git a/net/vhost-user.c b/net/vhost-user.c
index b368a90..e4dd089 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -82,15 +82,15 @@  static int vhost_user_start(int queues, NetClientState *ncs[])
         options.opaque      = s->chr;
         s->vhost_net = vhost_net_init(&options);
         if (!s->vhost_net) {
-            error_report("failed to init vhost_net for queue %d\n", i);
+            error_report("failed to init vhost_net for queue %d", i);
             goto err;
         }
 
         if (i == 0) {
             max_queues = vhost_net_get_max_queues(s->vhost_net);
             if (queues > max_queues) {
-                error_report("you are asking more queues than "
-                             "supported: %d\n", max_queues);
+                error_report("you are asking more queues than supported: %d",
+                             max_queues);
                 goto err;
             }
         }
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c2ff970..ec0e997 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2247,7 +2247,7 @@  GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
          */
         if (errno != ENOENT) {
             error_setg_errno(errp, errno, "Can't open directory"
-                             "\"/sys/devices/system/memory/\"\n");
+                             "\"/sys/devices/system/memory/\"");
         }
         return NULL;
     }
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 30739fc..cac27f9 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -649,7 +649,7 @@  static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
         uint32_t nr = cpu->pmsav7_dregion;
 
         if (nr > 0xff) {
-            error_setg(errp, "PMSAv7 MPU #regions invalid %" PRIu32 "\n", nr);
+            error_setg(errp, "PMSAv7 MPU #regions invalid %" PRIu32, nr);
             return;
         }
 
diff --git a/target-arm/machine.c b/target-arm/machine.c
index 36a0d15..b1e1418 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -337,11 +337,11 @@  const char *gicv3_class_name(void)
         return "kvm-arm-gicv3";
 #else
         error_report("KVM GICv3 acceleration is not supported on this "
-                     "platform\n");
+                     "platform");
 #endif
     } else {
         /* TODO: Software emulation is not implemented yet */
-        error_report("KVM is currently required for GICv3 emulation\n");
+        error_report("KVM is currently required for GICv3 emulation");
     }
 
     exit(1);