qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/4] Trivial patches for 2025-02-14
@ 2025-02-14  5:55 Michael Tokarev
  2025-02-14  5:55 ` [PULL 1/4] overall: Remove unnecessary g_strdup_printf() calls Michael Tokarev
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michael Tokarev @ 2025-02-14  5:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Tokarev, qemu-trivial

The following changes since commit ce315328f8e9bf5201db4217f3ffe0784110aa4b:

  Merge tag 'tracing-pull-request' of https://gitlab.com/stefanha/qemu into staging (2025-02-13 11:23:57 -0500)

are available in the Git repository at:

  https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches

for you to fetch changes up to b79b05d1a06a013447ea93b81c07612766b735f2:

  make-release: don't rely on $CWD when excluding subproject directories (2025-02-14 08:49:57 +0300)

----------------------------------------------------------------
trivial patches for 2025-02-14

There's nothing exciting here, just 4 very simple patches,
but one of them is important for qemu-stable.

----------------------------------------------------------------
Michael Roth (1):
      make-release: don't rely on $CWD when excluding subproject directories

Philippe Mathieu-Daudé (2):
      overall: Remove unnecessary g_strdup_printf() calls
      qemu/timer: Clarify timer_new*() must be freed with timer_free()

Rob Bradford (1):
      target/riscv: Fix minor whitespace issue in riscv_cpu_properties

 crypto/hash-afalg.c  |  2 +-
 hw/ppc/spapr_caps.c  |  2 +-
 include/qemu/timer.h | 10 ++++++++++
 plugins/loader.c     |  2 +-
 scripts/make-release |  9 +++++----
 target/i386/cpu.c    |  2 +-
 target/riscv/cpu.c   |  6 +++---
 trace/simple.c       |  2 +-
 ui/console.c         |  4 +---
 ui/gtk.c             |  3 +--
 util/module.c        |  2 +-
 11 files changed, 26 insertions(+), 18 deletions(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL 1/4] overall: Remove unnecessary g_strdup_printf() calls
  2025-02-14  5:55 [PULL 0/4] Trivial patches for 2025-02-14 Michael Tokarev
@ 2025-02-14  5:55 ` Michael Tokarev
  2025-02-14  5:55 ` [PULL 2/4] qemu/timer: Clarify timer_new*() must be freed with timer_free() Michael Tokarev
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2025-02-14  5:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, qemu-trivial, Michael Tokarev

From: Philippe Mathieu-Daudé <philmd@linaro.org>

Replace g_strdup_printf("%s", value) -> g_strdup(value)
to avoid unnecessary string formatting.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 crypto/hash-afalg.c | 2 +-
 hw/ppc/spapr_caps.c | 2 +-
 plugins/loader.c    | 2 +-
 target/i386/cpu.c   | 2 +-
 trace/simple.c      | 2 +-
 ui/console.c        | 4 +---
 ui/gtk.c            | 3 +--
 util/module.c       | 2 +-
 8 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/crypto/hash-afalg.c b/crypto/hash-afalg.c
index 8c0ce5b520..bd3fe3b427 100644
--- a/crypto/hash-afalg.c
+++ b/crypto/hash-afalg.c
@@ -59,7 +59,7 @@ qcrypto_afalg_hash_format_name(QCryptoHashAlgo alg,
     if (is_hmac) {
         name = g_strdup_printf("hmac(%s)", alg_name);
     } else {
-        name = g_strdup_printf("%s", alg_name);
+        name = g_strdup(alg_name);
     }
 
     return name;
diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index 7edd138360..904bff87ce 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -1034,7 +1034,7 @@ void spapr_caps_add_properties(SpaprMachineClass *smc)
     for (i = 0; i < ARRAY_SIZE(capability_table); i++) {
         SpaprCapabilityInfo *cap = &capability_table[i];
         g_autofree char *name = g_strdup_printf("cap-%s", cap->name);
-        g_autofree char *desc = g_strdup_printf("%s", cap->description);
+        g_autofree char *desc = g_strdup(cap->description);
 
         object_class_property_add(klass, name, cap->type,
                                   cap->get, cap->set,
diff --git a/plugins/loader.c b/plugins/loader.c
index ebc01da9c6..99686b5466 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -128,7 +128,7 @@ static int plugin_add(void *opaque, const char *name, const char *value,
                 /* Will treat arg="argname" as "argname=on" */
                 fullarg = g_strdup_printf("%s=%s", value, "on");
             } else {
-                fullarg = g_strdup_printf("%s", value);
+                fullarg = g_strdup(value);
             }
             warn_report("using 'arg=%s' is deprecated", value);
             error_printf("Please use '%s' directly\n", fullarg);
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b5dd60d281..72ab147e85 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6166,7 +6166,7 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
         desc = g_strdup_printf("%s [%s]", model_id, cc->model->note);
     }
     if (!desc) {
-        desc = g_strdup_printf("%s", model_id);
+        desc = g_strdup(model_id);
     }
 
     if (cc->model && cc->model->cpudef->deprecation_note) {
diff --git a/trace/simple.c b/trace/simple.c
index 18af590cf7..c0aba00cb7 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -366,7 +366,7 @@ void st_set_trace_file(const char *file)
         /* Type cast needed for Windows where getpid() returns an int. */
         trace_file_name = g_strdup_printf(CONFIG_TRACE_FILE "-" FMT_pid, (pid_t)getpid());
     } else {
-        trace_file_name = g_strdup_printf("%s", file);
+        trace_file_name = g_strdup(file);
     }
 
     st_set_trace_file_enabled(saved_enable);
diff --git a/ui/console.c b/ui/console.c
index 914ed2cc76..6456e8dd90 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1386,9 +1386,7 @@ char *qemu_console_get_label(QemuConsole *con)
                                        object_get_typename(c->device),
                                        c->head);
             } else {
-                return g_strdup_printf("%s", dev->id ?
-                                       dev->id :
-                                       object_get_typename(c->device));
+                return g_strdup(dev->id ? : object_get_typename(c->device));
             }
         }
         return g_strdup("VGA");
diff --git a/ui/gtk.c b/ui/gtk.c
index c023743148..59bda83da6 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1944,8 +1944,7 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
     vcd->console = vc;
 
     snprintf(buffer, sizeof(buffer), "vc%d", idx);
-    vc->label = g_strdup_printf("%s", vc->vte.chr->label
-                                ? vc->vte.chr->label : buffer);
+    vc->label = g_strdup(vc->vte.chr->label ? : buffer);
     group = gd_vc_menu_init(s, vc, idx, group, view_menu);
 
     vc->vte.terminal = vte_terminal_new();
diff --git a/util/module.c b/util/module.c
index 3eb0f06df1..1aa2079d01 100644
--- a/util/module.c
+++ b/util/module.c
@@ -234,7 +234,7 @@ int module_load(const char *prefix, const char *name, Error **errp)
 
     search_dir = getenv("QEMU_MODULE_DIR");
     if (search_dir != NULL) {
-        dirs[n_dirs++] = g_strdup_printf("%s", search_dir);
+        dirs[n_dirs++] = g_strdup(search_dir);
     }
     dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR);
 
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 2/4] qemu/timer: Clarify timer_new*() must be freed with timer_free()
  2025-02-14  5:55 [PULL 0/4] Trivial patches for 2025-02-14 Michael Tokarev
  2025-02-14  5:55 ` [PULL 1/4] overall: Remove unnecessary g_strdup_printf() calls Michael Tokarev
@ 2025-02-14  5:55 ` Michael Tokarev
  2025-02-14  5:55 ` [PULL 3/4] target/riscv: Fix minor whitespace issue in riscv_cpu_properties Michael Tokarev
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2025-02-14  5:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, qemu-trivial, Michael Tokarev

From: Philippe Mathieu-Daudé <philmd@linaro.org>

There was not mention QEMUTimer created with timer_new*() must
be released with timer_free() instead of g_free(), because then
active timers are removed from the active list. Update the
documentation mentioning timer_free().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/qemu/timer.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index cc167bd825..abd2204f3b 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -507,6 +507,8 @@ static inline void timer_init_ms(QEMUTimer *ts, QEMUClockType type,
  * with an AioContext---each of them runs its timer callbacks in its own
  * AioContext thread.
  *
+ * The timer returned must be freed using timer_free().
+ *
  * Returns: a pointer to the timer
  */
 static inline QEMUTimer *timer_new_full(QEMUTimerListGroup *timer_list_group,
@@ -530,6 +532,8 @@ static inline QEMUTimer *timer_new_full(QEMUTimerListGroup *timer_list_group,
  * and associate it with the default timer list for the clock type @type.
  * See timer_new_full for details.
  *
+ * The timer returned must be freed using timer_free().
+ *
  * Returns: a pointer to the timer
  */
 static inline QEMUTimer *timer_new(QEMUClockType type, int scale,
@@ -548,6 +552,8 @@ static inline QEMUTimer *timer_new(QEMUClockType type, int scale,
  * associated with the clock.
  * See timer_new_full for details.
  *
+ * The timer returned must be freed using timer_free().
+ *
  * Returns: a pointer to the newly created timer
  */
 static inline QEMUTimer *timer_new_ns(QEMUClockType type, QEMUTimerCB *cb,
@@ -566,6 +572,8 @@ static inline QEMUTimer *timer_new_ns(QEMUClockType type, QEMUTimerCB *cb,
  * associated with the clock.
  * See timer_new_full for details.
  *
+ * The timer returned must be freed using timer_free().
+ *
  * Returns: a pointer to the newly created timer
  */
 static inline QEMUTimer *timer_new_us(QEMUClockType type, QEMUTimerCB *cb,
@@ -584,6 +592,8 @@ static inline QEMUTimer *timer_new_us(QEMUClockType type, QEMUTimerCB *cb,
  * associated with the clock.
  * See timer_new_full for details.
  *
+ * The timer returned must be freed using timer_free().
+ *
  * Returns: a pointer to the newly created timer
  */
 static inline QEMUTimer *timer_new_ms(QEMUClockType type, QEMUTimerCB *cb,
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 3/4] target/riscv: Fix minor whitespace issue in riscv_cpu_properties
  2025-02-14  5:55 [PULL 0/4] Trivial patches for 2025-02-14 Michael Tokarev
  2025-02-14  5:55 ` [PULL 1/4] overall: Remove unnecessary g_strdup_printf() calls Michael Tokarev
  2025-02-14  5:55 ` [PULL 2/4] qemu/timer: Clarify timer_new*() must be freed with timer_free() Michael Tokarev
@ 2025-02-14  5:55 ` Michael Tokarev
  2025-02-14  5:55 ` [PULL 4/4] make-release: don't rely on $CWD when excluding subproject directories Michael Tokarev
  2025-02-14 16:58 ` [PULL 0/4] Trivial patches for 2025-02-14 Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2025-02-14  5:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: Rob Bradford, qemu-trivial, Michael Tokarev

From: Rob Bradford <rbradford@rivosinc.com>

The mvendorid/mimpid/marchid properties have the wrong amount of
whitespace ahead of them.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 3d4bd157d2..cca24b9f1f 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -2844,9 +2844,9 @@ static const Property riscv_cpu_properties[] = {
     {.name = "cbop_blocksize", .info = &prop_cbop_blksize},
     {.name = "cboz_blocksize", .info = &prop_cboz_blksize},
 
-     {.name = "mvendorid", .info = &prop_mvendorid},
-     {.name = "mimpid", .info = &prop_mimpid},
-     {.name = "marchid", .info = &prop_marchid},
+    {.name = "mvendorid", .info = &prop_mvendorid},
+    {.name = "mimpid", .info = &prop_mimpid},
+    {.name = "marchid", .info = &prop_marchid},
 
 #ifndef CONFIG_USER_ONLY
     DEFINE_PROP_UINT64("resetvec", RISCVCPU, env.resetvec, DEFAULT_RSTVEC),
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 4/4] make-release: don't rely on $CWD when excluding subproject directories
  2025-02-14  5:55 [PULL 0/4] Trivial patches for 2025-02-14 Michael Tokarev
                   ` (2 preceding siblings ...)
  2025-02-14  5:55 ` [PULL 3/4] target/riscv: Fix minor whitespace issue in riscv_cpu_properties Michael Tokarev
@ 2025-02-14  5:55 ` Michael Tokarev
  2025-02-14 16:58 ` [PULL 0/4] Trivial patches for 2025-02-14 Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2025-02-14  5:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Roth, qemu-trivial, Paolo Bonzini, Michael Tokarev,
	qemu-stable

From: Michael Roth <michael.roth@amd.com>

The current logic scans qemu.git/subprojects/ from *.wrap files to
determine whether or not to include the associated directories in the
release tarballs. However, the script assumes that it is being run from
the top-level of the source directory, which may not always be the case.
In particular, when generating releases via, e.g.:

  make qemu-9.2.1.tar.xz

the $CWD will either be an arbitrary external build directory, or
qemu.git/build, and the exclusions will not be processed as expected.
Fix this by using the $src parameter passed to the script as the root
directory for the various subproject/ paths referenced by this logic.

Also, the error case at the beginning of the subproject_dir() will not
result in the error message being printed, and will instead produce an
error message about "error" not being a valid command. Fix this by using
basic shell commands.

Fixes: be27b5149c86 ("make-release: only leave tarball of wrap-file subprojects")
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 scripts/make-release | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/make-release b/scripts/make-release
index 2885e87210..1b89b3423a 100755
--- a/scripts/make-release
+++ b/scripts/make-release
@@ -11,8 +11,9 @@
 # See the COPYING file in the top-level directory.
 
 function subproject_dir() {
-    if test ! -f "subprojects/$1.wrap"; then
-      error "scripts/archive-source.sh should only process wrap subprojects"
+    if test ! -f "$src/subprojects/$1.wrap"; then
+      echo "scripts/archive-source.sh should only process wrap subprojects"
+      exit 1
     fi
 
     # Print the directory key of the wrap file, defaulting to the
@@ -26,7 +27,7 @@ function subproject_dir() {
       -e    's///p' \
       -e    'q' \
       -e '}' \
-      "subprojects/$1.wrap")
+      "$src/subprojects/$1.wrap")
 
     echo "${dir:-$1}"
 }
@@ -76,7 +77,7 @@ popd
 exclude=(--exclude=.git)
 # include the tarballs in subprojects/packagecache but not their expansion
 for sp in $SUBPROJECTS; do
-    if grep -xqF "[wrap-file]" subprojects/$sp.wrap; then
+    if grep -xqF "[wrap-file]" $src/subprojects/$sp.wrap; then
       exclude+=(--exclude=subprojects/"$(subproject_dir $sp)")
     fi
 done
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PULL 0/4] Trivial patches for 2025-02-14
  2025-02-14  5:55 [PULL 0/4] Trivial patches for 2025-02-14 Michael Tokarev
                   ` (3 preceding siblings ...)
  2025-02-14  5:55 ` [PULL 4/4] make-release: don't rely on $CWD when excluding subproject directories Michael Tokarev
@ 2025-02-14 16:58 ` Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2025-02-14 16:58 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: qemu-devel, Michael Tokarev, qemu-trivial

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/10.0 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-17  8:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14  5:55 [PULL 0/4] Trivial patches for 2025-02-14 Michael Tokarev
2025-02-14  5:55 ` [PULL 1/4] overall: Remove unnecessary g_strdup_printf() calls Michael Tokarev
2025-02-14  5:55 ` [PULL 2/4] qemu/timer: Clarify timer_new*() must be freed with timer_free() Michael Tokarev
2025-02-14  5:55 ` [PULL 3/4] target/riscv: Fix minor whitespace issue in riscv_cpu_properties Michael Tokarev
2025-02-14  5:55 ` [PULL 4/4] make-release: don't rely on $CWD when excluding subproject directories Michael Tokarev
2025-02-14 16:58 ` [PULL 0/4] Trivial patches for 2025-02-14 Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).