From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: "Bernhard Beschow" <shentey@gmail.com>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
"Eduardo Habkost" <eduardo@habkost.net>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>
Subject: Re: [PATCH v2] hw/audio/pcspk: Inline pcspk_init()
Date: Fri, 20 Oct 2023 06:49:27 +0200 [thread overview]
Message-ID: <878r7xdhk8.fsf@pond.sub.org> (raw)
In-Reply-To: <5fd6c6c2-5245-c73c-6683-5136751dbde5@linaro.org> ("Philippe Mathieu-Daudé"'s message of "Thu, 19 Oct 2023 23:44:40 +0200")
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> On 19/10/23 19:54, Markus Armbruster wrote:
>> Bernhard Beschow <shentey@gmail.com> writes:
>>
>>> Am 19. Oktober 2023 07:33:07 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>>>> pcspk_init() is a legacy init function, inline and remove it.
>>>>
>>>> Since the device is realized using &error_fatal, use the same
>>>> error for setting the "pit" link.
>>>>
>>>> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> [...]
>>
>>>> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
>>>> index 63e0857208..79ffbb52a0 100644
>>>> --- a/hw/isa/i82378.c
>>>> +++ b/hw/isa/i82378.c
>>>> @@ -67,6 +67,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
>>>> uint8_t *pci_conf;
>>>> ISABus *isabus;
>>>> ISADevice *pit;
>>>> + ISADevice *pcspk;
>>>>
>>>> pci_conf = pci->config;
>>>> pci_set_word(pci_conf + PCI_COMMAND,
>>>> @@ -102,7 +103,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
>>>> pit = i8254_pit_init(isabus, 0x40, 0, NULL);
>>>>
>>>> /* speaker */
>>>> - pcspk_init(isa_new(TYPE_PC_SPEAKER), isabus, pit);
>>>> + pcspk = isa_new(TYPE_PC_SPEAKER);
>>>> + object_property_set_link(OBJECT(pcspk), "pit", OBJECT(pit), &error_fatal);
>>>> + isa_realize_and_unref(pcspk, isabus, &error_fatal);
>>>
>>> Why not pass errp here? I think that was Mark's comment in v1.
>
> That would more than "inlining".
Limiting this patch to exactly "inlining" makes sense. It makes the
"inapproproate use of &error_fatal" problem more visible. On the one
hand, that makes it more likely to be fixed some day. On the other
hand, it makes it a more effective bad example. Bad examples tend to
multiply.
> Can be updated on top, but so far
> this function is not error proof, so I'm not really worried.
Are there more inappropriate uses of &error_fatal in this function?
If no, please throw in a second patch to fix this one.
If yes, please add a FIXME comment. Unless you feel like fixing them
all, in which case go right ahead ;)
>> &error_fatal is almost always wrong in a function that takes Error **.
>> Happy to explain in more detail if needed.
>> [...]
next prev parent reply other threads:[~2023-10-20 4:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 7:33 [PATCH v2] hw/audio/pcspk: Inline pcspk_init() Philippe Mathieu-Daudé
2023-10-19 10:23 ` Bernhard Beschow
2023-10-19 17:54 ` Markus Armbruster
2023-10-19 21:44 ` Philippe Mathieu-Daudé
2023-10-20 4:49 ` Markus Armbruster [this message]
2023-10-20 10:02 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878r7xdhk8.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=eduardo@habkost.net \
--cc=hpoussin@reactos.org \
--cc=kraxel@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.