netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 1/3] r8169: replace BUG_ON with WARN in _rtl_eri_write
Date: Wed, 6 Jan 2021 14:18:54 -0800	[thread overview]
Message-ID: <CAKgT0UcbDT_ccC0M=hC121YZ3pVC1ht2uv9-vPDjMFtM5mKDWw@mail.gmail.com> (raw)
In-Reply-To: <619e6cc2-9253-fd1e-564a-eec944ee31e1@gmail.com>

On Wed, Jan 6, 2021 at 5:32 AM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Use WARN here to avoid stopping the system. In addition print the addr
> and mask values that triggered the warning.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 024042f37..9af048ad0 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
> @@ -763,7 +763,7 @@ static void _rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
>  {
>         u32 cmd = ERIAR_WRITE_CMD | type | mask | addr;
>
> -       BUG_ON((addr & 3) || (mask == 0));
> +       WARN(addr & 3 || !mask, "addr: 0x%x, mask: 0x%08x\n", addr, mask);
>         RTL_W32(tp, ERIDR, val);
>         r8168fp_adjust_ocp_cmd(tp, &cmd, type);
>         RTL_W32(tp, ERIAR, cmd);

Would it make more sense to perhaps just catch the case via an if
statement, display the warning, and then return instead of proceeding
with the write with the bad values?

I'm just wondering if this could make things worse by putting the
device in a bad state in some way resulting in either a timeout
waiting for a response or a hang.

  reply	other threads:[~2021-01-06 22:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 13:26 [PATCH net-next 0/3] r8169: small improvements Heiner Kallweit
2021-01-06 13:28 ` [PATCH net-next 1/3] r8169: replace BUG_ON with WARN in _rtl_eri_write Heiner Kallweit
2021-01-06 22:18   ` Alexander Duyck [this message]
2021-01-06 23:02     ` Heiner Kallweit
2021-01-06 13:28 ` [PATCH net-next 2/3] r8169: improve rtl_ocp_reg_failure Heiner Kallweit
2021-01-06 13:29 ` [PATCH net-next 3/3] r8169: don't wakeup-enable device on shutdown if WOL is disabled Heiner Kallweit
2021-01-06 18:10 ` [PATCH net-next 0/3] r8169: small improvements Heiner Kallweit

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='CAKgT0UcbDT_ccC0M=hC121YZ3pVC1ht2uv9-vPDjMFtM5mKDWw@mail.gmail.com' \
    --to=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.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).