Skip to contentSkip to conversation

staging: rtl8723bs: simplify xmit_frame initialization

PATCH In review Hungyu Lin 2 participants 5 messages Apr 3 Staging

lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

PATCH 1/1 staging: rtl8723bs: simplify xmit_frame initialization

Simplify initialization of pframe by combining declaration and assignment, improving readability.

No functional change.

---
 drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +3 -2
index a1f2cbf2cf55..84e58e53d708 100644
@@ -239,8 +239,9 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
 						/* pxmitbuf->priv_data will be NULL, and will crash here */
 						if (pxmitbuf->len > 0 &&
 						    pxmitbuf->priv_data) {
-							struct xmit_frame *pframe;
-							pframe = (struct xmit_frame *)pxmitbuf->priv_data;
+							struct xmit_frame *pframe =
+								pxmitbuf->priv_data;
+
 							pframe->agg_num = k;
 							pxmitbuf->agg_num = k;
 							rtl8723b_update_txdesc(pframe, pframe->buf_addr);
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 15 lines · Hungyu Lin

Simplify initialization of pframe by combining declaration and assignment, improving readability.

No functional change.

---
 drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +0 -0
index a1f2cbf2cf55..84e58e53d708 100644

drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv · line 244

Quoted 8 lines
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +3 -2
@@ -239,8 +239,9 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
 						/* pxmitbuf->priv_data will be NULL, and will crash here */
 						if (pxmitbuf->len > 0 &&
 						    pxmitbuf->priv_data) {
-							struct xmit_frame *pframe;
-							pframe = (struct xmit_frame *)pxmitbuf->priv_data;
+							struct xmit_frame *pframe =
+								pxmitbuf->priv_data;
+

This is now 3 lines, not 2, which didn't really help anything out in looking better.

What tool told you to make this change? It needs to be fixed.

thanks,

greg k-h

author
#2 lore raw

PATCH v2 1/1 staging: rtl8723bs: use single-line initialization for pframe

Combine declaration and assignment of pframe into a single line.

No functional change.

v2: adjust formatting based on review feedback.

---
 drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +2 -2
index a1f2cbf2cf55..c79df13b67a8 100644
@@ -239,8 +239,8 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
 						/* pxmitbuf->priv_data will be NULL, and will crash here */
 						if (pxmitbuf->len > 0 &&
 						    pxmitbuf->priv_data) {
-							struct xmit_frame *pframe;
-							pframe = (struct xmit_frame *)pxmitbuf->priv_data;
+							struct xmit_frame *pframe = pxmitbuf->priv_data;
+
 							pframe->agg_num = k;
 							pxmitbuf->agg_num = k;
 							rtl8723b_update_txdesc(pframe, pframe->buf_addr);
Signature · 1 line
2.34.1
maintainer
#3 lore raw

Re: [PATCH v2] staging: rtl8723bs: use single-line initialization for pframe

Quoted 1 line · Hungyu Lin

Combine declaration and assignment of pframe into a single line.

But why?

Quoted 4 lines

No functional change.

v2: adjust formatting based on review feedback.

This goes below the --- line.

Quoted 10 lines
---
 drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +0 -0
index a1f2cbf2cf55..c79df13b67a8 100644

drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv · line 243

Quoted 7 lines
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +2 -2
@@ -239,8 +239,8 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
 						/* pxmitbuf->priv_data will be NULL, and will crash here */
 						if (pxmitbuf->len > 0 &&
 						    pxmitbuf->priv_data) {
-							struct xmit_frame *pframe;
-							pframe = (struct xmit_frame *)pxmitbuf->priv_data;
+							struct xmit_frame *pframe = pxmitbuf->priv_data;
+

If the cast is not needed, that can be dropped, but really, I don't see what is wrong with the original code, do you?

What tool is asking you to make this change?

thanks,

greg k-h

author
#4 lore raw

Re: [PATCH v2] staging: rtl8723bs: use single-line initialization for pframe

Quoted 3 lines · Greg Kroah-Hartman

But why?
...
I don't see what is wrong with the original code, do you?

You are right, there is no real improvement over the original code.

I will drop this patch.

Thanks,
Hungyu

Quoted 39 lines · Greg KH
Quoted 1 line · Hungyu Lin

Combine declaration and assignment of pframe into a single line.

But why?

Quoted 4 lines

No functional change.

v2: adjust formatting based on review feedback.

This goes below the --- line.

Quoted 10 lines
---
 drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +0 -0
index a1f2cbf2cf55..c79df13b67a8 100644

drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv · line 243

Quoted 7 lines
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +2 -2
@@ -239,8 +239,8 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
                                              /* pxmitbuf->priv_data will be NULL, and will crash here */
                                              if (pxmitbuf->len > 0 &&
                                                  pxmitbuf->priv_data) {
-                                                     struct xmit_frame *pframe;
-                                                     pframe = (struct xmit_frame *)pxmitbuf->priv_data;
+                                                     struct xmit_frame *pframe = pxmitbuf->priv_data;
+

If the cast is not needed, that can be dropped, but really, I don't see what is wrong with the original code, do you?

What tool is asking you to make this change?

thanks,

greg k-h