From: "Chenqun (kuhn)" <kuhn.chenqun@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Zhanghailiang <zhang.zhanghailiang@huawei.com>,
QEMU Trivial <qemu-trivial@nongnu.org>,
Pannengyuan <pannengyuan@huawei.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Igor Mitsyanko <i.mitsyanko@gmail.com>,
Euler Robot <euler.robot@huawei.com>
Subject: RE: [PATCH v2 09/10] hw/intc: Remove redundant statement in exynos4210_combiner_read()
Date: Thu, 27 Aug 2020 07:00:46 +0000 [thread overview]
Message-ID: <7412CDE03601674DA8197E2EBD8937E83B8E58BD@dggemm511-mbx.china.huawei.com> (raw)
In-Reply-To: <CAFEAcA_SLjM28bHH8WxBdHAFdLgE6zgqNAj9EpOVp77WL-iqKg@mail.gmail.com>
> Subject: Re: [PATCH v2 09/10] hw/intc: Remove redundant statement in
> exynos4210_combiner_read()
>
> On Tue, 25 Aug 2020 at 12:26, Chen Qun <kuhn.chenqun@huawei.com> wrote:
> >
> > Clang static code analyzer show warning:
> > hw/intc/exynos4210_combiner.c:231:9: warning: Value stored to 'val' is never
> read
> > val = s->reg_set[offset >> 2];
> >
> > The default value of 'val' is '0', so we can break the 'default' branch and return
> 'val'.
> >
> > Reported-by: Euler Robot <euler.robot@huawei.com>
> > Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> > ---
> > Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
> > Cc: Peter Maydell <peter.maydell@linaro.org>
> > ---
> > hw/intc/exynos4210_combiner.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/hw/intc/exynos4210_combiner.c
> > b/hw/intc/exynos4210_combiner.c index b8561e4180..e2e745bbaa 100644
> > --- a/hw/intc/exynos4210_combiner.c
> > +++ b/hw/intc/exynos4210_combiner.c
> > @@ -228,8 +228,7 @@ exynos4210_combiner_read(void *opaque, hwaddr
> offset, unsigned size)
> > hw_error("exynos4210.combiner: overflow of reg_set by 0x"
> > TARGET_FMT_plx "offset\n", offset);
> > }
> > - val = s->reg_set[offset >> 2];
> > - return 0;
> > + break;
> > }
> > return val;
> > }
>
> The code as it stands is definitely wrong, but I'm not sure this is the correct fix.
> Surely the intention must have been to return the actual register value from
> the reg_set[] array, not to return 0 ?
>
> I suspect the correct fix here is simply to delete the "return 0" line and leave
> the assignment to val as it is.
Hi Peter,
I think you're right.
> Ideally you should check the h/w datasheet to confirm.
I checked the Exynos 4210 datasheet and found that 'Interrupt Combiner Operation' had only five types of registers.
Register Description Type
----------------------------------------------------------------------------------------------------------------------------------------
IESR(0/1/2/3) Interrupt Enable Set Register for Group (0~3/ 4 ~7/ 8~ 11/ 12~ 15) RW
IECR(0/1/2/3) Interrupt Enable Clear Register for Group (0~3/ 4 ~7/ 8~ 11/ 12~ 15) RW
ISTR(0/1/2/3) Interrupt Status Register for Group (0~3/ 4 ~7/ 8~ 11/ 12~ 15) R
IMSR(0/1/2/3) Interrupt Masked Status Register for Group(0~3/ 4 ~7/ 8~ 11/ 12~ 15) R
CIPSR0 Combined Interrupt Pending Status0 R
The exynos4210_combiner_write() function has write operations for IESR and IECR.
The CIPSR, ISTR, and IMSR read operations are specified in the exynos4210_combiner_read() function.
So, This 'default' branch in exynos4210_combiner_read() function read operation is only for IESR and IECR.
And, in the exynos4210_combiner_write function, the default assignment statement for IESR and IECR is " s->reg_set[offset >> 2] = val;".
Therefore, if we read the two register(IESR and IECR) values, we can directly use this assignment statement "val = s->reg_set[offset >> 2];".
Please confirm that if there is no problem, I will modify it in later version.
Thanks,
Chen Qun
next prev parent reply other threads:[~2020-08-27 7:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-25 11:24 [PATCH v2 00/10] trivial patchs for static code analyzer fixes Chen Qun
2020-08-25 11:24 ` [PATCH v2 01/10] hw/arm/virt-acpi-build:Remove dead assignment in build_madt() Chen Qun
2020-08-26 1:25 ` Li Qiang
2020-08-25 11:24 ` [PATCH v2 02/10] hw/arm/omap1:Remove redundant statement in omap_clkdsp_read() Chen Qun
2020-08-25 12:35 ` Peter Maydell
2020-08-26 1:26 ` Li Qiang
2020-08-25 11:24 ` [PATCH v2 03/10] target/arm/translate-a64:Remove dead assignment in handle_scalar_simd_shli() Chen Qun
2020-08-25 12:37 ` Peter Maydell
2020-08-26 2:42 ` Chenqun (kuhn)
2020-08-25 11:24 ` [PATCH v2 04/10] target/arm/translate-a64:Remove redundant statement in disas_simd_two_reg_misc_fp16() Chen Qun
2020-08-25 12:38 ` Peter Maydell
2020-08-25 11:24 ` [PATCH v2 05/10] hw/virtio/vhost-user:Remove dead assignment in scrub_shadow_regions() Chen Qun
2020-08-26 10:23 ` Li Qiang
2020-08-25 11:24 ` [PATCH v2 06/10] hw/net/virtio-net:Remove redundant statement in virtio_net_rsc_tcp_ctrl_check() Chen Qun
2020-08-26 1:35 ` Li Qiang
2020-08-25 11:24 ` [PATCH v2 07/10] vfio/platform: Remove dead assignment in vfio_intp_interrupt() Chen Qun
2020-08-25 15:00 ` Stefan Hajnoczi
2020-08-26 1:38 ` Li Qiang
2020-08-26 1:47 ` Chenqun (kuhn)
2020-08-26 10:14 ` Li Qiang
2020-08-25 11:24 ` [PATCH v2 08/10] usb/bus: Remove dead assignment in usb_get_fw_dev_path() Chen Qun
2020-08-25 14:39 ` Markus Armbruster
2020-08-26 1:59 ` Chenqun (kuhn)
2020-08-26 2:25 ` Chenqun (kuhn)
2020-08-25 11:24 ` [PATCH v2 09/10] hw/intc: Remove redundant statement in exynos4210_combiner_read() Chen Qun
2020-08-25 12:41 ` Peter Maydell
2020-08-27 7:00 ` Chenqun (kuhn) [this message]
2020-08-27 9:28 ` Peter Maydell
2020-08-25 11:24 ` [PATCH v2 10/10] hw/display/vga:Remove redundant statement in vga_draw_graphic() Chen Qun
2020-08-26 1:54 ` Li Qiang
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=7412CDE03601674DA8197E2EBD8937E83B8E58BD@dggemm511-mbx.china.huawei.com \
--to=kuhn.chenqun@huawei.com \
--cc=euler.robot@huawei.com \
--cc=i.mitsyanko@gmail.com \
--cc=pannengyuan@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=zhang.zhanghailiang@huawei.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 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).