* [PATCH] net: ethernet: sun: Remove redundant code
@ 2022-03-03 9:14 Jiapeng Chong
2022-03-03 14:22 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-03-03 9:14 UTC (permalink / raw)
To: davem; +Cc: kuba, gustavoars, netdev, linux-kernel, Jiapeng Chong,
Abaci Robot
Because CAS_FLAG_REG_PLUS is assigned a value of 1, it never enters
these for loops.
Clean up the following smatch warning:
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.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
drivers/net/ethernet/sun/cassini.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
index 947a76a788c7..153edc5eadad 100644
--- a/drivers/net/ethernet/sun/cassini.c
+++ b/drivers/net/ethernet/sun/cassini.c
@@ -1235,19 +1235,6 @@ static void cas_init_rx_dma(struct cas *cp)
*/
readl(cp->regs + REG_INTR_STATUS_ALIAS);
writel(INTR_RX_DONE | INTR_RX_BUF_UNAVAIL, cp->regs + REG_ALIAS_CLEAR);
- 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));
-
- /* 2 is different from 3 and 4 */
- if (N_RX_COMP_RINGS > 1)
- writel(INTR_RX_DONE_ALT | INTR_RX_BUF_UNAVAIL_1,
- cp->regs + REG_PLUS_ALIASN_CLEAR(1));
-
- for (i = 2; i < N_RX_COMP_RINGS; i++)
- writel(INTR_RX_DONE_ALT,
- cp->regs + REG_PLUS_ALIASN_CLEAR(i));
- }
/* set up pause thresholds */
val = CAS_BASE(RX_PAUSE_THRESH_OFF,
@@ -3509,9 +3496,6 @@ static inline void cas_start_dma(struct cas *cp)
if (N_RX_DESC_RINGS > 1)
writel(RX_DESC_RINGN_SIZE(1) - 4,
cp->regs + REG_PLUS_RX_KICK1);
-
- for (i = 1; i < N_RX_COMP_RINGS; i++)
- writel(0, cp->regs + REG_PLUS_RX_COMPN_TAIL(i));
}
}
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: ethernet: sun: Remove redundant code
2022-03-03 9:14 [PATCH] net: ethernet: sun: Remove redundant code Jiapeng Chong
@ 2022-03-03 14:22 ` Andrew Lunn
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2022-03-03 14:22 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: davem, kuba, gustavoars, netdev, linux-kernel, Abaci Robot
On Thu, Mar 03, 2022 at 05:14:40PM +0800, Jiapeng Chong wrote:
> Because CAS_FLAG_REG_PLUS is assigned a value of 1, it never enters
> these for loops.
Please can you expand this comment, it is not clear to my what you
mean here. When i look at:
/* check pci invariants */
static void cas_check_pci_invariants(struct cas *cp)
{
struct pci_dev *pdev = cp->pdev;
cp->cas_flags = 0;
if ((pdev->vendor == PCI_VENDOR_ID_SUN) &&
(pdev->device == PCI_DEVICE_ID_SUN_CASSINI)) {
if (pdev->revision >= CAS_ID_REVPLUS)
cp->cas_flags |= CAS_FLAG_REG_PLUS;
it is not obvious why it could not enter these loops.
Andrew
>
> Clean up the following smatch warning:
>
> 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.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> drivers/net/ethernet/sun/cassini.c | 16 ----------------
> 1 file changed, 16 deletions(-)
>
> diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
> index 947a76a788c7..153edc5eadad 100644
> --- a/drivers/net/ethernet/sun/cassini.c
> +++ b/drivers/net/ethernet/sun/cassini.c
> @@ -1235,19 +1235,6 @@ static void cas_init_rx_dma(struct cas *cp)
> */
> readl(cp->regs + REG_INTR_STATUS_ALIAS);
> writel(INTR_RX_DONE | INTR_RX_BUF_UNAVAIL, cp->regs + REG_ALIAS_CLEAR);
> - 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));
> -
> - /* 2 is different from 3 and 4 */
> - if (N_RX_COMP_RINGS > 1)
> - writel(INTR_RX_DONE_ALT | INTR_RX_BUF_UNAVAIL_1,
> - cp->regs + REG_PLUS_ALIASN_CLEAR(1));
> -
> - for (i = 2; i < N_RX_COMP_RINGS; i++)
> - writel(INTR_RX_DONE_ALT,
> - cp->regs + REG_PLUS_ALIASN_CLEAR(i));
> - }
>
> /* set up pause thresholds */
> val = CAS_BASE(RX_PAUSE_THRESH_OFF,
> @@ -3509,9 +3496,6 @@ static inline void cas_start_dma(struct cas *cp)
> if (N_RX_DESC_RINGS > 1)
> writel(RX_DESC_RINGN_SIZE(1) - 4,
> cp->regs + REG_PLUS_RX_KICK1);
> -
> - for (i = 1; i < N_RX_COMP_RINGS; i++)
> - writel(0, cp->regs + REG_PLUS_RX_COMPN_TAIL(i));
> }
> }
>
> --
> 2.20.1.7.g153144c
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-03 14:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-03 9:14 [PATCH] net: ethernet: sun: Remove redundant code Jiapeng Chong
2022-03-03 14:22 ` Andrew Lunn
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).