[PATCH] staging: rtl8723bs: split chained assignment in xmit_linux.c

Keith Teeple posted 1 patch 1 month, 1 week ago
drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] staging: rtl8723bs: split chained assignment in xmit_linux.c
Posted by Keith Teeple 1 month, 1 week ago
checkpatch reports that multiple assignments should be avoided.
Split the chained assignment into two separate statements.

Signed-off-by: Keith Teeple <keithrteeple@gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 0be3143fffe5..62243ab5fcd4 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -6,7 +6,6 @@
  ******************************************************************************/
 #include <drv_types.h>
 
-
 uint rtw_remainder_len(struct pkt_file *pfile)
 {
 	return (pfile->buf_len - ((SIZE_PTR)(pfile->cur_addr) - (SIZE_PTR)(pfile->buf_start)));
@@ -15,9 +14,10 @@ uint rtw_remainder_len(struct pkt_file *pfile)
 void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
 {
 	pfile->pkt = pktptr;
-	pfile->cur_addr = pfile->buf_start = pktptr->data;
-	pfile->pkt_len = pfile->buf_len = pktptr->len;
-
+	pfile->buf_start = pktptr->data;
+	pfile->cur_addr = pfile->buf_start;
+	pfile->buf_len = pktptr->len;
+	pfile->pkt_len = pfile->buf_len;
 	pfile->cur_buffer = pfile->buf_start;
 }
 
-- 
2.53.0
Re: [PATCH] staging: rtl8723bs: split chained assignment in xmit_linux.c
Posted by Dan Carpenter 1 month, 1 week ago
On Wed, Feb 25, 2026 at 07:10:19PM -0500, Keith Teeple wrote:
> @@ -15,9 +14,10 @@ uint rtw_remainder_len(struct pkt_file *pfile)
>  void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
>  {
>  	pfile->pkt = pktptr;
> -	pfile->cur_addr = pfile->buf_start = pktptr->data;
> -	pfile->pkt_len = pfile->buf_len = pktptr->len;
> -
> +	pfile->buf_start = pktptr->data;
> +	pfile->cur_addr = pfile->buf_start;

Please don't do it like this.  Do it like this:

	pfile->buf_start = pktptr->data;
	pfile->cur_addr = pktptr->data;

Otherwise we have made the new version harder to read than the original
code.

regards,
dan carpenter

> +	pfile->buf_len = pktptr->len;
> +	pfile->pkt_len = pfile->buf_len;
>  	pfile->cur_buffer = pfile->buf_start;
>  }
>  
> -- 
> 2.53.0
>
Re: [PATCH] staging: rtl8723bs: split chained assignment in xmit_linux.c
Posted by Andy Shevchenko 1 month, 1 week ago
On Thu, Feb 26, 2026 at 10:20:26AM +0300, Dan Carpenter wrote:
> On Wed, Feb 25, 2026 at 07:10:19PM -0500, Keith Teeple wrote:

...

> >  void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
> >  {
> >  	pfile->pkt = pktptr;
> > -	pfile->cur_addr = pfile->buf_start = pktptr->data;
> > -	pfile->pkt_len = pfile->buf_len = pktptr->len;
> > -
> > +	pfile->buf_start = pktptr->data;
> > +	pfile->cur_addr = pfile->buf_start;
> 
> Please don't do it like this.  Do it like this:

+1, good advice!

> 	pfile->buf_start = pktptr->data;
> 	pfile->cur_addr = pktptr->data;
> 
> Otherwise we have made the new version harder to read than the original
> code.

Not only read, but prone to subtle mistakes in the future!


> > +	pfile->buf_len = pktptr->len;
> > +	pfile->pkt_len = pfile->buf_len;
> >  	pfile->cur_buffer = pfile->buf_start;
> >  }

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] staging: rtl8723bs: split chained assignment in xmit_linux.c
Posted by Greg KH 1 month, 1 week ago
On Wed, Feb 25, 2026 at 07:10:19PM -0500, Keith Teeple wrote:
> @@ -6,7 +6,6 @@
>   ******************************************************************************/
>  #include <drv_types.h>
>  
> -
>  uint rtw_remainder_len(struct pkt_file *pfile)
>  {
>  	return (pfile->buf_len - ((SIZE_PTR)(pfile->cur_addr) - (SIZE_PTR)(pfile->buf_start)));

This change has nothing to do with splitting chained assignments :(