Category: Linux

Staging: hv: Transform PDEVICE_OBJECT and DEVICE_OBJECT typedefs into their corresponding structs

Author: Nicolas Palix <npalix@diku.dk> Remove typedef DEVICE_OBJECT and use a struct named hv_device instead. Remove typedef PDEVICE_OBJECT which aliases a pointer and use struct hv_device * instead. Here is the semantic patch to perform this transformation: (http://coccinelle.lip6.fr/) // @rm_PDEVICE_OBJECT@ @@ -typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT; @rm_DEVICE_OBJECT@ @@ -typedef struct _DEVICE_OBJECT +struct hv_device {…} -DEVICE_OBJECT ; @fixtypedef_PDEVICE_OBJECT@ …

Continue reading

Staging: Correct use of ! and &

Author: Julia Lawall <julia@diku.dk> Correct priority problem in the use of ! and &. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; constant C; @@ – !E & C + !(E & C) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/rt3090/sta_ioctl.c | 6 ++—- drivers/staging/vt6656/iwctl.c | 3 …

Continue reading

drivers/atm: Correct redundant test

Author: Julia Lawall <julia@diku.dk> str has already been tested. It seems that this test should be on the recently returned value snr. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; @@ if (x == NULL || …) { … when …

Continue reading

Btrfs: Correct redundant test in add_inode_ref

Author: Julia Lawall <julia@diku.dk> dir has already been tested. It seems that this test should be on the recently returned value inode. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) Signed-off-by: Julia Lawall Signed-off-by: Chris Mason — fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) …

Continue reading

fs/xfs: Correct redundant test

Author: Julia Lawall <julia@diku.dk> bp was tested for NULL a few lines before, followed by a return, and there is no intervening modification of its value. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; position p1,p2; @@ if (x == …

Continue reading

fs/xfs: Correct redundant test

Author: Julia Lawall <julia@diku.dk> bp was tested for NULL a few lines before, followed by a return, and there is no intervening modification of its value. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; position p1,p2; @@ if (x == …

Continue reading

net/netlabel: Correct redundant test

Author: Julia Lawall <julia@diku.dk> entry was tested for NULL near the beginning of the function, followed by a return, and there is no intervening modification of its value. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; position p1,p2; @@ if …

Continue reading

drivers/net: Correct redundant test

Author: Julia Lawall <julia@diku.dk> res has already been tested. It seems that this test should be on the recently returned value mmio. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; @@ if (x == NULL || …) { … when …

Continue reading

ISDN: ARRAY_SIZE changes

Author: Karsten Keil <keil@b1-systems.de> These changes were a direct result of using a semantic patch More information can be found at http://www.emn.fr/x-info/coccinelle/ Modified some of the changes to avoid the extra define. Signed-off-by: Stoyan Gaydarov Signed-off-by: Karsten Keil — drivers/isdn/act2000/capi.c | 3 +– drivers/isdn/act2000/module.c | 31 +++++++++++++++—————- drivers/isdn/hardware/eicon/message.c | 4 +— drivers/isdn/hardware/eicon/os_4bri.c | 3 +– …

Continue reading

Staging: hv: Transform some kzalloc calls to kcalloc

Author: Nicolas Palix <npalix@diku.dk> Here is a short excerpt of the semantic patch performing this transformation: (http://www.emn.fr/x-info/coccinelle/) // @@ expression E1,E2,E3; @@ – kzalloc(E1*sizeof(E2),E3) + kcalloc(E1,sizeof(E2),E3) @@ expression E1,E3; type T; @@ – kzalloc(E1*sizeof(T),E3) + kcalloc(E1,sizeof(T),E3) // Signed-off-by: Nicolas Palix Cc: Hank Janssen Cc: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman — drivers/staging/hv/storvsc_drv.c | 6 +++— 1 …

Continue reading