Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Philippe Mathieu-Daudé
On 10/11/23 12:20, Daniel P. Berrangé wrote: On Fri, Nov 10, 2023 at 12:44:56PM +0200, Manos Pitsidianakis wrote: On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: This kind of thing is why Coverity's unused-result warning has a lot of false positives. We shouldn't introduce extra code like this

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Daniel P . Berrangé
On Fri, Nov 10, 2023 at 12:35:56PM +0100, BALATON Zoltan wrote: > On Fri, 10 Nov 2023, Daniel P. Berrangé wrote: > > On Fri, Nov 10, 2023 at 12:44:56PM +0200, Manos Pitsidianakis wrote: > > > On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: > > > > This kind of thing is why Coverity's unused-result

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread BALATON Zoltan
On Fri, 10 Nov 2023, Daniel P. Berrangé wrote: On Fri, Nov 10, 2023 at 12:44:56PM +0200, Manos Pitsidianakis wrote: On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: This kind of thing is why Coverity's unused-result warning has a lot of false positives. We shouldn't introduce extra code like th

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Manos Pitsidianakis
On Fri, 10 Nov 2023 13:23, "Daniel P. Berrangé" wrote: On Fri, Nov 10, 2023 at 11:18:39AM +, Peter Maydell wrote: On Fri, 10 Nov 2023 at 11:02, Manos Pitsidianakis wrote: > > On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: > >This kind of thing is why Coverity's unused-result warning has

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Manos Pitsidianakis
On Fri, 10 Nov 2023 13:20, "Daniel P. Berrangé" wrote: Your approach to the problem: if (!AUD_register_card("OMAP EAC", &s->codec.card, &error_fatal)) { exit(1); } is adding dead-code because the exit(1) will never be reachable. So while it lets you squelch the unused result warning, it i

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Daniel P . Berrangé
On Fri, Nov 10, 2023 at 11:18:39AM +, Peter Maydell wrote: > On Fri, 10 Nov 2023 at 11:02, Manos Pitsidianakis > wrote: > > > > On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: > > >This kind of thing is why Coverity's unused-result warning has a > > >lot of false positives. We shouldn't intro

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Daniel P . Berrangé
On Fri, Nov 10, 2023 at 12:44:56PM +0200, Manos Pitsidianakis wrote: > On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: > > This kind of thing is why Coverity's unused-result warning has a > > lot of false positives. We shouldn't introduce extra code like > > this to work around the fact that the t

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Peter Maydell
On Fri, 10 Nov 2023 at 11:02, Manos Pitsidianakis wrote: > > On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: > >This kind of thing is why Coverity's unused-result warning has a > >lot of false positives. We shouldn't introduce extra code like > >this to work around the fact that the tooling doesn

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Manos Pitsidianakis
On Fri, 10 Nov 2023 12:21, Peter Maydell wrote: This kind of thing is why Coverity's unused-result warning has a lot of false positives. We shouldn't introduce extra code like this to work around the fact that the tooling doesn't understand our error-handling convention (i.e. error_fatal, and th

Re: [PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Peter Maydell
On Fri, 10 Nov 2023 at 09:16, Manos Pitsidianakis wrote: > > Ignoring the return value by accident is easy to miss as a bug. Such a > bug was spotted by Coverity CID 1523899. Now, future instances of this > type of bug will produce a warning when using GCC. > > Signed-off-by: Manos Pitsidianakis

[PATCH 2/2] Add warn_unused_result attr to AUD_register_card

2023-11-10 Thread Manos Pitsidianakis
Ignoring the return value by accident is easy to miss as a bug. Such a bug was spotted by Coverity CID 1523899. Now, future instances of this type of bug will produce a warning when using GCC. Signed-off-by: Manos Pitsidianakis --- audio/audio.h | 2 +- hw/arm/omap2.c | 8 +++- hw/i