All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chenqun (kuhn)" <kuhn.chenqun@huawei.com>
To: Laurent Vivier <laurent@vivier.eu>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>
Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"philmd@redhat.com" <philmd@redhat.com>,
	Zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Euler Robot <euler.robot@huawei.com>
Subject: RE: [PATCH v4 3/3] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write()
Date: Tue, 24 Mar 2020 12:22:37 +0000	[thread overview]
Message-ID: <7412CDE03601674DA8197E2EBD8937E83B6BF788@dggemm511-mbx.china.huawei.com> (raw)
In-Reply-To: <b1e4dbf2-842a-dedd-819e-4f2b272dcfb9@vivier.eu>

>-----Original Message-----
>From: Laurent Vivier [mailto:laurent@vivier.eu]
>Sent: Tuesday, March 24, 2020 6:59 PM
>To: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; qemu-devel@nongnu.org;
>qemu-trivial@nongnu.org
>Cc: Zhanghailiang <zhang.zhanghailiang@huawei.com>; philmd@redhat.com;
>Euler Robot <euler.robot@huawei.com>; Igor Mitsyanko
><i.mitsyanko@gmail.com>; Peter Maydell <peter.maydell@linaro.org>
>Subject: Re: [PATCH v4 3/3] timer/exynos4210_mct: Remove redundant
>statement in exynos4210_mct_write()
>
>Le 24/03/2020 à 09:22, Chen Qun a écrit :
>> Clang static code analyzer show warning:
>> hw/timer/exynos4210_mct.c:1370:9: warning: Value stored to 'index' is never
>read
>>         index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
>>         ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> hw/timer/exynos4210_mct.c:1399:9: warning: Value stored to 'index' is never
>read
>>         index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
>>         ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> hw/timer/exynos4210_mct.c:1441:9: warning: Value stored to 'index' is never
>read
>>         index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
>>         ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>It would be interesting to understand why we need the index for these registers
>in exynos4210_mct_read() and not in exynos4210_mct_write().
>
I think the index can also be used in exynos4210_mct_write(), but the original author used a more obvious reg name instead of it.

The obvious reg name:
case L0_TCNTB: case L1_TCNTB:
           reg name is :  L_REG_CNT_TCNTB 

case L0_ICNTB: case L1_ICNTB:
           reg name is :   L_REG_CNT_ICNTB

case L0_FRCNTB: case L1_FRCNTB:
           reg name is :   L_REG_CNT_FRCCNTB

Thanks.
>
>> 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/timer/exynos4210_mct.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
>> index 944120aea5..570cf7075b 100644
>> --- a/hw/timer/exynos4210_mct.c
>> +++ b/hw/timer/exynos4210_mct.c
>> @@ -1367,7 +1367,6 @@ static void exynos4210_mct_write(void *opaque,
>> hwaddr offset,
>>
>>      case L0_TCNTB: case L1_TCNTB:
>>          lt_i = GET_L_TIMER_IDX(offset);
>> -        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
>>
>>          /*
>>           * TCNTB is updated to internal register only after CNT expired.
>> @@ -1396,7 +1395,6 @@ static void exynos4210_mct_write(void *opaque,
>> hwaddr offset,
>>
>>      case L0_ICNTB: case L1_ICNTB:
>>          lt_i = GET_L_TIMER_IDX(offset);
>> -        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
>>
>>          s->l_timer[lt_i].reg.wstat |= L_WSTAT_ICNTB_WRITE;
>>          s->l_timer[lt_i].reg.cnt[L_REG_CNT_ICNTB] = value & @@
>> -1438,8 +1436,6 @@ static void exynos4210_mct_write(void *opaque,
>> hwaddr offset,
>>
>>      case L0_FRCNTB: case L1_FRCNTB:
>>          lt_i = GET_L_TIMER_IDX(offset);
>> -        index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);
>> -
>>          DPRINTF("local timer[%d] FRCNTB write %llx\n", lt_i, value);
>>
>>          s->l_timer[lt_i].reg.wstat |= L_WSTAT_FRCCNTB_WRITE;
>>


  reply	other threads:[~2020-03-24 12:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24  8:22 [PATCH v4 0/3] redundant code: Fix warnings reported by Clang static code analyzer Chen Qun
2020-03-24  8:22 ` [PATCH v4 1/3] scsi/esp-pci: Remove redundant statement in esp_pci_io_write() Chen Qun
2020-03-24  8:27   ` Laurent Vivier
2020-03-24  8:22 ` [PATCH v4 2/3] display/blizzard: Remove redundant statement in blizzard_draw_line16_32() Chen Qun
2020-03-24  8:38   ` Laurent Vivier
2020-03-24  8:40     ` Laurent Vivier
2020-03-24 11:49       ` Chenqun (kuhn)
2020-03-24  8:22 ` [PATCH v4 3/3] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write() Chen Qun
2020-03-24 10:59   ` Laurent Vivier
2020-03-24 12:22     ` Chenqun (kuhn) [this message]
2020-03-24 13:21       ` Laurent Vivier

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=7412CDE03601674DA8197E2EBD8937E83B6BF788@dggemm511-mbx.china.huawei.com \
    --to=kuhn.chenqun@huawei.com \
    --cc=euler.robot@huawei.com \
    --cc=i.mitsyanko@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --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 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.