All of lore.kernel.org
 help / color / mirror / Atom feed
* Coccinelle based patch processing
@ 2022-11-01 14:14 Deepak R Varma
  2022-11-01 14:34 ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Deepak R Varma @ 2022-11-01 14:14 UTC (permalink / raw)
  To: outreachy

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

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

[-- Attachment #2: cocci-auto.patch --]
[-- Type: text/x-diff, Size: 3063 bytes --]

diff -u -p a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
--- a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
@@ -149,7 +149,6 @@ static void fill_txdesc_phy(struct pkt_a

 static 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_fra
 	ODM_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 */
diff -u -p a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -1415,7 +1415,6 @@ static int amsdu_to_msdu(struct adapter

 	struct 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)
diff -u -p a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
--- a/drivers/staging/r8188eu/core/rtw_ap.c
+++ b/drivers/staging/r8188eu/core/rtw_ap.c
@@ -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 *padapt
 	u8 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 *padapt

 	associated_clients_update(padapter, true);

-	return ret;
+	return 0;
 }

 /* called > TSR LEVEL for USB or SDIO Interface*/
diff -u -p a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -2979,8 +2979,6 @@ static int rtw_p2p_set(struct net_device
 			       struct 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_device
 		rtw_p2p_set_persistent(dev, info, wrqu, &extra[11]);
 	}

-	return ret;
+	return 0;
 }

 static int rtw_p2p_get2(struct net_device *dev,


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Coccinelle based patch processing
  2022-11-01 14:14 Coccinelle based patch processing Deepak R Varma
@ 2022-11-01 14:34 ` Julia Lawall
  2022-11-01 14:52   ` Deepak R Varma
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2022-11-01 14:34 UTC (permalink / raw)
  To: Deepak R Varma; +Cc: outreachy



On Tue, 1 Nov 2022, Deepak R Varma wrote:

> 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


>
> Thank you,
> ./drv
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Coccinelle based patch processing
  2022-11-01 14:34 ` Julia Lawall
@ 2022-11-01 14:52   ` Deepak R Varma
  2022-11-01 15:09     ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Deepak R Varma @ 2022-11-01 14:52 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy

On Tue, Nov 01, 2022 at 03:34:52PM +0100, Julia Lawall wrote:
>
>
> On Tue, 1 Nov 2022, Deepak R Varma wrote:
>
> > 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.

>
> 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

>
> julia
>
>
> >
> > Thank you,
> > ./drv
> >
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Coccinelle based patch processing
  2022-11-01 14:52   ` Deepak R Varma
@ 2022-11-01 15:09     ` Julia Lawall
  2022-11-01 15:19       ` Deepak R Varma
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2022-11-01 15:09 UTC (permalink / raw)
  To: Deepak R Varma; +Cc: outreachy



On Tue, 1 Nov 2022, Deepak R Varma wrote:

> On Tue, Nov 01, 2022 at 03:34:52PM +0100, Julia Lawall wrote:
> >
> >
> > On Tue, 1 Nov 2022, Deepak R Varma wrote:
> >
> > > 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

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.

>    2) build
>    3) commit
>    4) generate and send patch using mutt format-patch

Yes.

> 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

> In the later case, I am not building the driver to ensure the changes are
> accurate.
>
> Can you please comment.
>
> >
> > 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
>
> >
> > julia
> >
> >
> > >
> > > Thank you,
> > > ./drv
> > >
> >
>
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Coccinelle based patch processing
  2022-11-01 15:09     ` Julia Lawall
@ 2022-11-01 15:19       ` Deepak R Varma
  2022-11-01 15:28         ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Deepak R Varma @ 2022-11-01 15:19 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy

On Tue, Nov 01, 2022 at 04:09:33PM +0100, Julia Lawall wrote:
>
>
> On Tue, 1 Nov 2022, Deepak R Varma wrote:
>
> > On Tue, Nov 01, 2022 at 03:34:52PM +0100, Julia Lawall wrote:
> > >
> > >
> > > On Tue, 1 Nov 2022, Deepak R Varma wrote:
> > >
> > > > 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
>
> 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.

Thank you again!
./drv

>
> 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.
>
> >    2) build
> >    3) commit
> >    4) generate and send patch using mutt format-patch
>
> Yes.
>
> > 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
>
> > In the later case, I am not building the driver to ensure the changes are
> > accurate.
> >
> > Can you please comment.
> >
> > >
> > > 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
> >
> > >
> > > julia
> > >
> > >
> > > >
> > > > Thank you,
> > > > ./drv
> > > >
> > >
> >
> >
> >



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Coccinelle based patch processing
  2022-11-01 15:19       ` Deepak R Varma
@ 2022-11-01 15:28         ` Julia Lawall
  2022-11-01 16:57           ` Deepak R Varma
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2022-11-01 15:28 UTC (permalink / raw)
  To: Deepak R Varma; +Cc: outreachy



On Tue, 1 Nov 2022, Deepak R Varma wrote:

> On Tue, Nov 01, 2022 at 04:09:33PM +0100, Julia Lawall wrote:
> >
> >
> > On Tue, 1 Nov 2022, Deepak R Varma wrote:
> >
> > > On Tue, Nov 01, 2022 at 03:34:52PM +0100, Julia Lawall wrote:
> > > >
> > > >
> > > > On Tue, 1 Nov 2022, Deepak R Varma wrote:
> > > >
> > > > > 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
> >
> > 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

>
> Thank you again!
> ./drv
>
> >
> > 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.
> >
> > >    2) build
> > >    3) commit
> > >    4) generate and send patch using mutt format-patch
> >
> > Yes.
> >
> > > 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
> >
> > > In the later case, I am not building the driver to ensure the changes are
> > > accurate.
> > >
> > > Can you please comment.
> > >
> > > >
> > > > 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
> > >
> > > >
> > > > julia
> > > >
> > > >
> > > > >
> > > > > Thank you,
> > > > > ./drv
> > > > >
> > > >
> > >
> > >
> > >
>
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Coccinelle based patch processing
  2022-11-01 15:28         ` Julia Lawall
@ 2022-11-01 16:57           ` Deepak R Varma
  0 siblings, 0 replies; 7+ messages in thread
From: Deepak R Varma @ 2022-11-01 16:57 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy

On Tue, Nov 01, 2022 at 04:28:50PM +0100, Julia Lawall wrote:
>
>
> On Tue, 1 Nov 2022, Deepak R Varma wrote:
>
> > On Tue, Nov 01, 2022 at 04:09:33PM +0100, Julia Lawall wrote:
> > >
> > >
> > > On Tue, 1 Nov 2022, Deepak R Varma wrote:
> > >
> > > > On Tue, Nov 01, 2022 at 03:34:52PM +0100, Julia Lawall wrote:
> > > > >
> > > > >
> > > > > On Tue, 1 Nov 2022, Deepak R Varma wrote:
> > > > >
> > > > > > 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
> > >
> > > 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

>
> julia
>
> >
> > Thank you again!
> > ./drv
> >
> > >
> > > 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.
> > >
> > > >    2) build
> > > >    3) commit
> > > >    4) generate and send patch using mutt format-patch
> > >
> > > Yes.
> > >
> > > > 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
> > >
> > > > In the later case, I am not building the driver to ensure the changes are
> > > > accurate.
> > > >
> > > > Can you please comment.
> > > >
> > > > >
> > > > > 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
> > > >
> > > > >
> > > > > julia
> > > > >
> > > > >
> > > > > >
> > > > > > Thank you,
> > > > > > ./drv
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> >
> >
> >
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-01 16:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 14:14 Coccinelle based patch processing Deepak R Varma
2022-11-01 14:34 ` Julia Lawall
2022-11-01 14:52   ` Deepak R Varma
2022-11-01 15:09     ` Julia Lawall
2022-11-01 15:19       ` Deepak R Varma
2022-11-01 15:28         ` Julia Lawall
2022-11-01 16:57           ` Deepak R Varma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.