From: Andrew Lunn <andrew@lunn.ch>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>,
David Miller <davem@davemloft.net>
Cc: davem@davemloft.net, kuba@kernel.org, gustavoars@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Abaci Robot <abaci@linux.alibaba.com>
Subject: Re: [PATCH v2] net: ethernet: sun: Remove redundant code
Date: Fri, 4 Mar 2022 14:32:57 +0100 [thread overview]
Message-ID: <YiIVCVnY6K5FQwVm@lunn.ch> (raw)
In-Reply-To: <20220304083653.66238-1-jiapeng.chong@linux.alibaba.com>
On Fri, Mar 04, 2022 at 04:36:53PM +0800, Jiapeng Chong wrote:
> Since the starting value in the for loop is greater than or equal to 1,
> the restriction is CAS_FLAG_REG_PLUS is in the file cassini.h is
> defined as 0x1 by macro, and the for loop and if condition is not
> satisfied, so the code here is redundant.
This still does not make much sense. Too late, David has merged it.
Taking a deeper look, we see:
https://elixir.bootlin.com/linux/v5.17-rc6/source/drivers/net/ethernet/sun/cassini.h#L2542
#define N_RX_COMP_RINGS 0x1 /* for mult. PCI interrupts */
So what the bot is reporting:
> drivers/net/ethernet/sun/cassini.c:3513 cas_start_dma() warn: we never
> enter this loop.
>
> drivers/net/ethernet/sun/cassini.c:1239 cas_init_rx_dma() warn: we never
> enter this loop.
>
> drivers/net/ethernet/sun/cassini.c:1247 cas_init_rx_dma() warn: we never
> enter this loop.
>
> - if (cp->cas_flags & CAS_FLAG_REG_PLUS) {
> - for (i = 1; i < N_RX_COMP_RINGS; i++)
> - readl(cp->regs + REG_PLUS_INTRN_STATUS_ALIAS(i));
has nothing to do with CAS_FLAG_REG_PLUS, which you say in your commit
message. It has to do with N_RX_COMP_RINGS.
So you have 'fixed' a bots warning by removing code which cannot be
used. But is this the correct fix? Or has the bot actually found a
bug? Don't you think somebody wrote this code expecting it to be used?
Or do you think people write extra code which will never be used for
fun?
Looking at the git history, this code was actually written by DaveM.
Dave, this very old code, do you still remember this hardware? Bug or
dead code?
Andrew
prev parent reply other threads:[~2022-03-04 13:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 8:36 [PATCH v2] net: ethernet: sun: Remove redundant code Jiapeng Chong
2022-03-04 13:10 ` patchwork-bot+netdevbpf
2022-03-04 13:32 ` Andrew Lunn [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=YiIVCVnY6K5FQwVm@lunn.ch \
--to=andrew@lunn.ch \
--cc=abaci@linux.alibaba.com \
--cc=davem@davemloft.net \
--cc=gustavoars@kernel.org \
--cc=jiapeng.chong@linux.alibaba.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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 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.