Coccinelle based patch processing
Hello,
I have a coccicheck produced patch [attached here] using the following command. Can you please suggest how to submit this as a patch? Is there a document that I can follow to accomplish the submission?
make coccicheck COCCI=./scripts/coccinelle/misc/returnvar.cocci M=driver/staging/r8188eu/ MODE=patch
Thank you,
./drv
drivers/staging/r8188eu/hal/rtl8188eu_xmit.c +1 -2
@@ -149,7 +149,6 @@ static void fill_txdesc_phy(struct pkt_astatic s32 update_txdesc (struct xmit_frame *pxmitframe,u8 *pmem,s32 sz,u8 bagg_pkt) { -int pull =0 ;uint qsel;u8 data_rate, pwr_status, offset;struct adapter *adapt = pxmitframe->padapter;
@@ -295,7 +294,7 @@ static s32 update_txdesc(struct xmit_fraODM_SetTxAntByTxInfo_88E (&haldata->odmpriv, pmem, pattrib->mac_id);rtl8188eu_cal_txdesc_chksum (ptxdesc); -return pull; +return 0 ; }/* for non-agg data frame or management frame */
drivers/staging/r8188eu/core/rtw_recv.c +1 -2
@@ -1415,7 +1415,6 @@ static int amsdu_to_msdu(struct adapterstruct recv_priv *precvpriv = &padapter->recvpriv;struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue; -int ret = _SUCCESS; nr_subframes =0 ;
@@ -1513,7 +1512,7 @@ exit: prframe->len =0 ;rtw_free_recvframe (prframe, pfree_recv_queue);/* free this recv_frame */ -return ret; +return _SUCCESS; }static bool check_indicate_seq (struct recv_reorder_ctrl *preorder_ctrl,u16 seq_num)
drivers/staging/r8188eu/core/rtw_ap.c +2 -3
@@ -1020,7 +1020,6 @@ u8 ap_free_sta(struct adapter *padapter,int rtw_sta_flush (struct adapter *padapter) {struct list_head *phead, *plist; -int ret =0 ;struct sta_info *psta =NULL ;struct sta_priv *pstapriv = &padapter->stapriv;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1028,7 +1027,7 @@ int rtw_sta_flush(struct adapter *padaptu8 bc_addr[ETH_ALEN ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };if ((pmlmeinfo->state &0x03 ) !=WIFI_FW_AP_STATE ) -return ret; +return 0 ;spin_lock_bh (&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list;
@@ -1051,7 +1050,7 @@ int rtw_sta_flush(struct adapter *padaptassociated_clients_update (padapter, true); -return ret; +return 0 ; }/* called > TSR LEVEL for USB or SDIO Interface*/
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -3
@@ -2979,8 +2979,6 @@ static int rtw_p2p_set(struct net_devicestruct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret = 0; - if (!memcmp(extra, "enable =", 7)) { rtw_wext_p2p_enable(dev, info, wrqu, &extra[7 ]); } else if (!memcmp(extra, "setDN =", 6)) {
@@ -3027,7 +3025,7 @@ static int rtw_p2p_set(struct net_devicertw_p2p_set_persistent (dev, info, wrqu, &extra[11 ]); } -return ret; +return 0 ; } static int rtw_p2p_get2(struct net_device *dev,
Quoted 6 lines · Deepak R Varma
Hello,
I have a coccicheck produced patch [attached here] using the following command. Can you please suggest how to submit this as a patch? Is there a document that I can follow to accomplish the submission?make coccicheck COCCI=./scripts/coccinelle/misc/returnvar.cocci M=driver/staging/r8188eu/ MODE=patch
Do what you would have done if you had made the patch by hand.
If the changes are quite identical, then you can group changes on multiple files into one.
But in this case, even though all the changes do the same thing, it may not be a good idea to group them, because the context is different in each case. In particular, you should check each case to see whether the return variable really was unnecessary, or whether it actually was necessary, and the developer forgot to set it to something.
julia
Quoted 4 lines
Thank you,
./drv
Quoted 4 lines · Julia Lawall
On Tue, 1 Nov 2022, Deepak R Varma wrote:
Quoted 8 lines
Quoted 6 lines
Hello,
I have a coccicheck produced patch [attached here] using the following command. Can you please suggest how to submit this as a patch? Is there a document that I can follow to accomplish the submission?make coccicheck COCCI=./scripts/coccinelle/misc/returnvar.cocci M=driver/staging/r8188eu/ MODE=patch
Do what you would have done if you had made the patch by hand.
You mean:
1) review and implement the patch suggested changes manually onto my local patch branch
2) build
3) commit
4) generate and send patch using mutt format-patch
Or is simply do a "mutt -H cocci-auto.patch" and add the subject and patch log at the time of compiling the email?
In the later case, I am not building the driver to ensure the changes are accurate.
Can you please comment.
Quoted 9 lines
If the changes are quite identical, then you can group changes on multiple files into one.
But in this case, even though all the changes do the same thing, it may not be a good idea to group them, because the context is different in each case. In particular, you should check each case to see whether the return variable really was unnecessary, or whether it actually was necessary, and the developer forgot to set it to something.
Okay. I will review this once again before submitting the patch(es).
./drv
Quoted 9 lines
julia
Quoted 4 lines
Thank you,
./drv
Quoted 10 lines · Deepak R Varma
Quoted 9 lines · Julia Lawall
Quoted 5 lines · Deepak R Varma
Hello,
I have a coccicheck produced patch [attached here] using the following command. Can you please suggest how to submit this as a patch? Is there a document that I can follow to accomplish the submission?
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
make coccicheck COCCI=./scripts/coccinelle/misc/returnvar.cocci M=driver/staging/r8188eu/ MODE=patch
Do what you would have done if you had made the patch by hand.
You mean:
1) review and implement the patch suggested changes manually onto my local patch branch
I don't understand what you mean by "implement ... manually". Coccinelle gives you a patch. YOu can just apply that patch to your tree. There is no need to change anything manually.
But then you should look at the changes carefully in the context in which they occur, to determine whether they are correct, or you should do something else.
You can also study the provided patch itself and remove changes to any file that do not seem suitable.
Quoted 3 lines
2) build
3) commit
4) generate and send patch using mutt format-patch
Yes.
Quoted 2 lines
Or is simply do a "mutt -H cocci-auto.patch" and add the subject and patch log at the time of compiling the email?
No.
julia
Quoted 31 lines
In the later case, I am not building the driver to ensure the changes are accurate.
Can you please comment.
Quoted 9 lines
If the changes are quite identical, then you can group changes on multiple files into one.
But in this case, even though all the changes do the same thing, it may not be a good idea to group them, because the context is different in each case. In particular, you should check each case to see whether the return variable really was unnecessary, or whether it actually was necessary, and the developer forgot to set it to something.
Okay. I will review this once again before submitting the patch(es).
./drv
Quoted 9 lines
julia
Quoted 4 lines
Thank you,
./drv
Quoted 16 lines · Julia Lawall
Quoted 12 lines · Deepak R Varma
Quoted 11 lines · Julia Lawall
Quoted 6 lines · Deepak R Varma
Hello,
I have a coccicheck produced patch [attached here] using the following command. Can you please suggest how to submit this as a patch? Is there a document that I can follow to accomplish the submission?make coccicheck COCCI=./scripts/coccinelle/misc/returnvar.cocci M=driver/staging/r8188eu/ MODE=patch
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Do what you would have done if you had made the patch by hand.
You mean:
1) review and implement the patch suggested changes manually onto my local patch branchI don't understand what you mean by "implement ... manually". Coccinelle gives you a patch. YOu can just apply that patch to your tree. There is no need to change anything manually.
Thank you Julia. I was not aware of the "git apply" feature. Never used it in the past. Now I know.
Thank you again!
./drv
Quoted 52 lines
But then you should look at the changes carefully in the context in which they occur, to determine whether they are correct, or you should do something else.
You can also study the provided patch itself and remove changes to any file that do not seem suitable.
Quoted 3 lines
2) build
3) commit
4) generate and send patch using mutt format-patchYes.
Quoted 2 lines
Or is simply do a "mutt -H cocci-auto.patch" and add the subject and patch log at the time of compiling the email?
No.
julia
Quoted 31 lines
In the later case, I am not building the driver to ensure the changes are accurate.
Can you please comment.
Quoted 9 lines
If the changes are quite identical, then you can group changes on multiple files into one.
But in this case, even though all the changes do the same thing, it may not be a good idea to group them, because the context is different in each case. In particular, you should check each case to see whether the return variable really was unnecessary, or whether it actually was necessary, and the developer forgot to set it to something.
Okay. I will review this once again before submitting the patch(es).
./drv
Quoted 9 lines
julia
Quoted 4 lines
Thank you,
./drv
Quoted 22 lines · Deepak R Varma
Quoted 21 lines · Julia Lawall
Quoted 16 lines · Deepak R Varma
Quoted 4 lines · Julia Lawall
On Tue, 1 Nov 2022, Deepak R Varma wrote:
Quoted 8 lines
Quoted 6 lines
Hello,
I have a coccicheck produced patch [attached here] using the following command. Can you please suggest how to submit this as a patch? Is there a document that I can follow to accomplish the submission?make coccicheck COCCI=./scripts/coccinelle/misc/returnvar.cocci M=driver/staging/r8188eu/ MODE=patch
Do what you would have done if you had made the patch by hand.
You mean:
1) review and implement the patch suggested changes manually onto my local patch branch
Quoted 6 lines
Quoted 3 lines
I don't understand what you mean by "implement ... manually". Coccinelle gives you a patch. YOu can just apply that patch to your tree. There is no need to change anything manually.
Thank you Julia. I was not aware of the "git apply" feature. Never used it in the past. Now I know.
You can also just use patch -p1 < thepatch
julia
Quoted 59 lines
Thank you again!
./drvQuoted 52 lines
But then you should look at the changes carefully in the context in which they occur, to determine whether they are correct, or you should do something else.
You can also study the provided patch itself and remove changes to any file that do not seem suitable.
Quoted 3 lines
2) build
3) commit
4) generate and send patch using mutt format-patchYes.
Quoted 2 lines
Or is simply do a "mutt -H cocci-auto.patch" and add the subject and patch log at the time of compiling the email?
No.
julia
Quoted 31 lines
In the later case, I am not building the driver to ensure the changes are accurate.
Can you please comment.
Quoted 9 lines
If the changes are quite identical, then you can group changes on multiple files into one.
But in this case, even though all the changes do the same thing, it may not be a good idea to group them, because the context is different in each case. In particular, you should check each case to see whether the return variable really was unnecessary, or whether it actually was necessary, and the developer forgot to set it to something.
Okay. I will review this once again before submitting the patch(es).
./drv
Quoted 9 lines
julia
Quoted 4 lines
Thank you,
./drv
Quoted 26 lines · Julia Lawall
Quoted 22 lines · Deepak R Varma
Quoted 21 lines · Julia Lawall
Quoted 16 lines · Deepak R Varma
Quoted 4 lines · Julia Lawall
On Tue, 1 Nov 2022, Deepak R Varma wrote:
Quoted 8 lines
Quoted 6 lines
Hello,
I have a coccicheck produced patch [attached here] using the following command. Can you please suggest how to submit this as a patch? Is there a document that I can follow to accomplish the submission?make coccicheck COCCI=./scripts/coccinelle/misc/returnvar.cocci M=driver/staging/r8188eu/ MODE=patch
Do what you would have done if you had made the patch by hand.
You mean:
1) review and implement the patch suggested changes manually onto my local patch branch
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I don't understand what you mean by "implement ... manually". Coccinelle gives you a patch. YOu can just apply that patch to your tree. There is no need to change anything manually.
Thank you Julia. I was not aware of the "git apply" feature. Never used it in the past. Now I know.
You can also just use patch -p1 < thepatch
That was super easy! Thank you Julia. I just submitted the patch for review and feedback.
./drv
Quoted 63 lines
julia
Quoted 59 lines
Thank you again!
./drvQuoted 52 lines
But then you should look at the changes carefully in the context in which they occur, to determine whether they are correct, or you should do something else.
You can also study the provided patch itself and remove changes to any file that do not seem suitable.
Quoted 3 lines
2) build
3) commit
4) generate and send patch using mutt format-patchYes.
Quoted 2 lines
Or is simply do a "mutt -H cocci-auto.patch" and add the subject and patch log at the time of compiling the email?
No.
julia
Quoted 31 lines
In the later case, I am not building the driver to ensure the changes are accurate.
Can you please comment.
Quoted 9 lines
If the changes are quite identical, then you can group changes on multiple files into one.
But in this case, even though all the changes do the same thing, it may not be a good idea to group them, because the context is different in each case. In particular, you should check each case to see whether the return variable really was unnecessary, or whether it actually was necessary, and the developer forgot to set it to something.
Okay. I will review this once again before submitting the patch(es).
./drv
Quoted 9 lines
julia
Quoted 4 lines
Thank you,
./drv