On Tue, 10 Mar 2026 at 12:27, Markus Armbruster <[email protected]> wrote:
> Or simply use a cover letter.
Patchew doesn't correctly handle cover-letter + single patch,
so my recommendation is "cover letter if and only if there
is more than one patch".
> > hw/block/block.c | 5 ++---
> > hw/core/qdev.c | 19 ++++++++-----------
> > include/hw/core/qdev.h | 13 -------------
> > 3 files changed, 10 insertions(+), 27 deletions(-)
> >
> > diff --git a/hw/block/block.c b/hw/block/block.c
> > index f187fa025d..84e5298e2f 100644
> > --- a/hw/block/block.c
> > +++ b/hw/block/block.c
> > @@ -65,7 +65,6 @@ bool blk_check_size_and_read_all(BlockBackend *blk,
> > DeviceState *dev,
> > {
> > int64_t blk_len;
> > int ret;
> > - g_autofree char *dev_id = NULL;
> >
> > if (cpr_is_incoming()) {
> > return true;
> > @@ -78,7 +77,7 @@ bool blk_check_size_and_read_all(BlockBackend *blk,
> > DeviceState *dev,
> > return false;
> > }
> > if (blk_len != size) {
> > - dev_id = qdev_get_human_name(dev);
> > + g_autofree const char *dev_id = qdev_get_printable_name(dev);
> > error_setg(errp, "%s device '%s' requires %" HWADDR_PRIu
> > " bytes, %s block backend provides %" PRIu64 " bytes",
> > object_get_typename(OBJECT(dev)), dev_id, size,
>
> I believe this plugs a memory leak.
It doesn't -- the previous declaration of dev_id above also
is marked g_autofree. This patch is just moving the declarations
into a narrower scope.
> > -/**
> > - * qdev_get_human_name() - Return a human-readable name for a device
> > - * @dev: The device. Must be a valid and non-NULL pointer.
> > - *
> > - * .. note::
> > - * This function is intended for user friendly error messages.
> > - *
> > - * Returns: A newly allocated string containing the device id if not null,
> > - * else the object canonical path.
> > - *
> > - * Use g_free() to free it.
> > - */
> > -char *qdev_get_human_name(DeviceState *dev);
>
> Please add a similarly nice contract to qdev_get_printable_name().
Mostly that is in
https://patchew.org/QEMU/[email protected]/[email protected]/
thanks
-- PMM