[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d6f843b90b7146059332c82159ba79ff@realtek.com>
Date: Wed, 29 Nov 2023 12:47:31 +0000
From: Hayes Wang <hayeswang@...ltek.com>
To: Douglas Anderson <dianders@...omium.org>,
Jakub Kicinski <kuba@...nel.org>,
"David S . Miller" <davem@...emloft.net>
CC: Laura Nao <laura.nao@...labora.com>,
Edward Hill <ecgh@...omium.org>,
Alan Stern <stern@...land.harvard.edu>,
Grant Grundler <grundler@...omium.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
Simon Horman <horms@...nel.org>,
Bjørn Mork <bjorn@...k.no>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net v2 2/5] r8152: Add RTL8152_INACCESSIBLE checks to more loops
Douglas Anderson <dianders@...omium.org>
> Sent: Wednesday, November 29, 2023 5:38 AM
[...]
> @@ -3000,6 +3000,8 @@ static void rtl8152_nic_reset(struct r8152 *tp)
> ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, CR_RST);
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
> if (!(ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CR) & CR_RST))
> break;
> usleep_range(100, 400);
> @@ -3329,6 +3331,8 @@ static void rtl_disable(struct r8152 *tp)
> rxdy_gated_en(tp, true);
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
I think you have to replace return with break.
Otherwise, rtl_stop_rx() wouldn't be called.
And, you may free the memory which is using, when rtl8152_close () is called.
> ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
> if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY)
> break;
> @@ -3336,6 +3340,8 @@ static void rtl_disable(struct r8152 *tp)
> }
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
Same as above.
> if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY)
> break;
> usleep_range(1000, 2000);
> @@ -5499,6 +5505,8 @@ static void wait_oob_link_list_ready(struct r8152 *tp)
> int i;
>
> for (i = 0; i < 1000; i++) {
> + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> + return;
> ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
> if (ocp_data & LINK_LIST_READY)
> break;
> --
Best Regards,
Hayes
Powered by blists - more mailing lists