Skip to contentSkip to conversation

hw/arm/virt.c: Remove newline from error_report() string

PATCH In review Peter Maydell 2 participants 5 messages Jan 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/virt.c: Remove newline from error_report() string

error_report() strings should not include trailing newlines; remove the newline from the error we print when devices won't fit into the address space of the CPU.

This commit also fixes the accidental hardcoded tabs that were in this line, since we have to touch the line anyway.

---
 hw/arm/virt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/virt.c +2 -2
index 2793121cb41..da6cea30534 100644
@@ -1771,8 +1771,8 @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits)
     /* Base address of the high IO region */
     memtop = base = device_memory_base + ROUND_UP(device_memory_size, GiB);
     if (memtop > BIT_ULL(pa_bits)) {
-	    error_report("Addressing limited to %d bits, but memory exceeds it by %llu bytes\n",
-			 pa_bits, memtop - BIT_ULL(pa_bits));
+        error_report("Addressing limited to %d bits, but memory exceeds it by %llu bytes",
+                     pa_bits, memtop - BIT_ULL(pa_bits));
         exit(EXIT_FAILURE);
     }
     if (base < device_memory_base) {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Peter Maydell

error_report() strings should not include trailing newlines; remove the newline from the error we print when devices won't fit into the address space of the CPU.

This commit also fixes the accidental hardcoded tabs that were in this line, since we have to touch the line anyway.

---
  hw/arm/virt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
#2 lore raw
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Peter Maydell

error_report() strings should not include trailing newlines; remove the newline from the error we print when devices won't fit into the address space of the CPU.

This commit also fixes the accidental hardcoded tabs that were in this line, since we have to touch the line anyway.

Quoted 6 lines
Quoted 4 lines

---
  hw/arm/virt.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)

BTW there is another case:

$ spatch \
  --macro-file scripts/cocci-macro-file.h \
  --sp-file scripts/coccinelle/err-bad-newline.cocci \
  --keep-comments --use-gitgrep --dir .
./hw/arm/virt.c:1775:38:"Addressing limited to %d bits, but memory exceeds it by %llu bytes\n"
./ui/gtk.c:1094:56:"gtk: unexpected touch event type\n"

We could run this some of these coccinelle scripts on CI, as a new job in .gitlab-ci.d/static_checks.yml or extending the check-patch job...

Patch on the way for ui/gtk.c.

#3 lore raw
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Peter Maydell

error_report() strings should not include trailing newlines; remove the newline from the error we print when devices won't fit into the address space of the CPU.

This commit also fixes the accidental hardcoded tabs that were in this line, since we have to touch the line anyway.

Quoted 6 lines
Quoted 4 lines
---
  hw/arm/virt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

BTW there is another case:

$ spatch \
   --macro-file scripts/cocci-macro-file.h \
   --sp-file scripts/coccinelle/err-bad-newline.cocci \
   --keep-comments --use-gitgrep --dir .
./hw/arm/virt.c:1775:38:"Addressing limited to %d bits, but memory
exceeds it by %llu bytes\n"
./ui/gtk.c:1094:56:"gtk: unexpected touch event type\n"
Quoted 3 lines

We could run this some of these coccinelle scripts on CI, as a new job in .gitlab-ci.d/static_checks.yml or extending the check-patch job...

checkpatch catches it, if you read the output, which is how I noticed this in the first place (I was originally touching the line to fix the tab damage).

-- PMM

#4 lore raw
Quoted 28 lines · Peter Maydell
Quoted 27 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Peter Maydell

error_report() strings should not include trailing newlines; remove the newline from the error we print when devices won't fit into the address space of the CPU.

This commit also fixes the accidental hardcoded tabs that were in this line, since we have to touch the line anyway.

Quoted 6 lines
Quoted 4 lines
---
   hw/arm/virt.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)

BTW there is another case:

$ spatch \
    --macro-file scripts/cocci-macro-file.h \
    --sp-file scripts/coccinelle/err-bad-newline.cocci \
    --keep-comments --use-gitgrep --dir .
./hw/arm/virt.c:1775:38:"Addressing limited to %d bits, but memory
exceeds it by %llu bytes\n"
./ui/gtk.c:1094:56:"gtk: unexpected touch event type\n"
Quoted 7 lines
Quoted 3 lines

We could run this some of these coccinelle scripts on CI, as a new job in .gitlab-ci.d/static_checks.yml or extending the check-patch job...

checkpatch catches it, if you read the output, which is how I noticed this in the first place (I was originally touching the line to fix the tab damage).

Ah, no need to waste more CI minutes then :)

Thanks!