From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
BALATON Zoltan <balaton@eik.bme.hu>
Cc: Qemu-block <qemu-block@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Max Reitz <mreitz@redhat.com>, qemu-ppc <qemu-ppc@nongnu.org>,
John Snow <jsnow@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: Coverity CID 1421984
Date: Mon, 23 Mar 2020 16:28:13 +0100 [thread overview]
Message-ID: <b78b7d6d-de20-6997-7d2a-ba19b850f30e@redhat.com> (raw)
In-Reply-To: <CAFEAcA_R1i2L5Vgmq1frGbQQxggLtEfMwHa8V=+K2Wje2mkVVA@mail.gmail.com>
On 3/23/20 3:46 PM, Peter Maydell wrote:
> On Mon, 23 Mar 2020 at 14:43, BALATON Zoltan <balaton@eik.bme.hu> wrote:
>>
>> On Mon, 23 Mar 2020, Peter Maydell wrote:
>>> On Mon, 23 Mar 2020 at 14:06, BALATON Zoltan <balaton@eik.bme.hu> wrote:
>>>> On Mon, 23 Mar 2020, Peter Maydell wrote:
>>>>> Coverity has flagged up a lot of leaks involving qemu_allocate_irqs();
>>>>> most of them I've for the moment just set as "insignificant, fix
>>>>> required" because they're in called-once functions like board init.
>>>>> If this device can't be hot-unplugged and so we will only ever call
>>>>> realize once, it would fall in that category too. Otherwise I'd
>>>>> suggest conversion to qdev_init_gpio_in(). (This allocates arrays
>>>>> of IRQs under the hood too, but the device_finalize() function will
>>>>> automatically free them for you, so it's easier to use non-leakily.)
>>>>
>>>> I think I can't do that in sii3112 becuase I need to pass irq to this func:
>>>>
>>>> void ide_init2(IDEBus *bus, qemu_irq irq);
>>>
>>> ide_init2(bus, qdev_get_gpio_in(DEVICE(dev), i);
>>>
>>> should do what you want, I think.
>>
>> I don't understand what you mean.
>
> I mean that if you allocate the IRQs with qdev_init_gpio_in()
> then the way to get a qemu_irq from within them to pass
> to another function is to call qdev_get_gpio_in(). So you
> just want to make your call to ide_init2() be the line I
> suggest above.
I understand Zoltan can have hard time understanding qdev_get_gpio_in()
because it has no documentation. What would be the best example to follow?
>
>> Sent a patch that I think might fix this
>> warning for now. I'd leave qdevifying ide code to someone else.
>
> There's no need to qdevify IDE for this.
>
> thanks
> -- PMM
>
prev parent reply other threads:[~2020-03-23 15:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 11:46 Coverity CID 1421984 Max Reitz
2020-03-23 11:58 ` Philippe Mathieu-Daudé
2020-03-23 13:11 ` BALATON Zoltan
2020-03-23 13:26 ` Max Reitz
2020-03-23 13:35 ` Peter Maydell
2020-03-23 14:06 ` BALATON Zoltan
2020-03-23 14:35 ` Peter Maydell
2020-03-23 14:43 ` BALATON Zoltan
2020-03-23 14:46 ` Peter Maydell
2020-03-23 15:28 ` BALATON Zoltan
2020-03-23 15:33 ` Peter Maydell
2020-03-23 15:28 ` Philippe Mathieu-Daudé [this message]
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=b78b7d6d-de20-6997-7d2a-ba19b850f30e@redhat.com \
--to=philmd@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=david@gibson.dropbear.id.au \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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 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).