Re: [PATCH] Staging: wimax: i2400m: fixing several coding style issues.

From: Joe Perches
Date: Sun Jan 31 2021 - 23:21:14 EST


On Sun, 2021-01-31 at 23:42 +0300, dev.dragon@xxxxx wrote:

> diff --git a/drivers/staging/wimax/i2400m/rx.c b/drivers/staging/wimax/i2400m/rx.c
[]
> @@ -764,9 +763,9 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
>   new_nws);
>   __skb_unlink(skb_itr, &roq->queue);
>   i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
> - }
> - else
> + } else {
>   break; /* rest of packets all nsn_itr > nws */
> + }
>   }

Rather than merely fixing what checkpatch complains about, it'd be
better to reverse the test above and break directly then unindent
the expected block.
---
drivers/staging/wimax/i2400m/rx.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/rx.c b/drivers/staging/wimax/i2400m/rx.c
index c9fb619a9e01..caeba9694b4e 100644
--- a/drivers/staging/wimax/i2400m/rx.c
+++ b/drivers/staging/wimax/i2400m/rx.c
@@ -757,16 +757,12 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
roq_data_itr = (struct i2400m_roq_data *) &skb_itr->cb;
nsn_itr = __i2400m_roq_nsn(roq, roq_data_itr->sn);
/* NSN bounds assumed correct (checked when it was queued) */
- if (nsn_itr < new_nws) {
- d_printf(2, dev, "ERX: roq %p - release skb %p "
- "(nsn %u/%u new nws %u)\n",
- roq, skb_itr, nsn_itr, roq_data_itr->sn,
- new_nws);
- __skb_unlink(skb_itr, &roq->queue);
- i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
- }
- else
- break; /* rest of packets all nsn_itr > nws */
+ if (nsn_itr >= new_nws)
+ break;
+ d_printf(2, dev, "ERX: roq %p - release skb %p (nsn %u/%u new nws %u)\n",
+ roq, skb_itr, nsn_itr, roq_data_itr->sn, new_nws);
+ __skb_unlink(skb_itr, &roq->queue);
+ i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
}
roq->ws = sn;
return new_nws;