Category: Linux

usb: gadget: Use kmemdup instead of kmalloc + memcpy

Author: Benoit Taine <benoit.taine@lip6.fr> This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine Signed-off-by: Felipe Balbi — drivers/usb/gadget/configfs.c | 4 +— drivers/usb/gadget/lpc32xx_udc.c | 3 +– 2 files changed, 2 insertions(+), 5 deletions(-)   diff –git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 2ddcd63..bcc2a62 100644 — a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1021,12 +1021,10 @@ static …

Continue reading

qla2xxx: Use kmemdup instead of kmalloc + memcpy

Author: Benoit Taine <benoit.taine@lip6.fr> This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine Acked-by: Saurav Kashyap Signed-off-by: Christoph Hellwig — drivers/scsi/qla2xxx/qla_mbx.c | 3 +– 1 file changed, 1 insertion(+), 2 deletions(-)   diff –git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 7f39e36..1c33a77 100644 — a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -1319,7 +1319,7 @@ qla2x00_get_node_name_list(scsi_qla_host_t *vha, …

Continue reading

wcn36xx: Use kmemdup instead of kmalloc + memcpy

Author: Benoit Taine <benoit.taine@lip6.fr> This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine Signed-off-by: John W. Linville — drivers/net/wireless/ath/wcn36xx/smd.c | 3 +– 1 file changed, 1 insertion(+), 2 deletions(-)   diff –git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 7bf0ef8..6398693 100644 — a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2068,7 +2068,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx …

Continue reading

qla4xxx: Use kmemdup instead of kmalloc + memcpy

Author: Benoit Taine <benoit.taine@lip6.fr> This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine Acked-by: Vikas Chaudhary Signed-off-by: Christoph Hellwig — drivers/scsi/qla4xxx/ql4_os.c | 7 +++—- 1 file changed, 3 insertions(+), 4 deletions(-)   diff –git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 9eef7d4..3202063 100644 — a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -3565,14 +3565,13 @@ static int …

Continue reading

USB: storage: ene_ub6250: Use kmemdup instead of kmalloc + memcpy

Author: Benoit Taine <benoit.taine@lip6.fr> This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine Signed-off-by: Greg Kroah-Hartman — drivers/usb/storage/ene_ub6250.c | 3 +– 1 file changed, 1 insertion(+), 2 deletions(-)   diff –git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index 1bfc9a6..ef6efb5 100644 — a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -1928,11 +1928,10 @@ static int ene_load_bincode(struct us_data *us, …

Continue reading

drivers/staging: Remove useless return variables

Author: Peter Senna Tschudin <peter.senna@gmail.com> This patch remove variables that are initialized with a constant, are never updated, and are only used as parameter of return. Return the constant instead of using a variable. Verified by compilation only. The coccinelle script that find and fixes this issue is: // @@ type T; constant C; identifier …

Continue reading

video: msm: Introduce the use of the managed version of kzalloc

Author: Himangi Saraogi <himangi774@gmail.com> This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. Also, linux/device.h is added to make sure the devm_*() routine declarations are unambiguously available. The function mddi_dummy_remove is removed as it is no longer required after removing the …

Continue reading

ix86/mid/thermal: Introduce the use of the managed version of kzalloc

Author: Himangi Saraogi <himangi774@gmail.com> This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. The following Coccinelle semantic patch was used for making the change: @platform@ identifier p, probefn, removefn; @@ struct platform_driver p = { .probe = probefn, .remove = removefn, …

Continue reading

staging: rtl8712: remove _malloc()

Author: Vitaly Osipov <vitaly.osipov@gmail.com> This patch removes all usage of _malloc() and the function itself. Most uses are straightforward replacements by kmalloc(…, GFP_ATOMIC), because this was the definition of _malloc(). In a few places it was possible to use kzalloc() or memdup_user. A further improvement would be to replace GFP_ATOMIC with GFP_KERNEL where possible. Verified …

Continue reading

mtd: bf5xx_nand: use the managed version of kzalloc

Author: Himangi Saraogi <himangi774@gmail.com> This patch moves data allocated using kzalloc to managed data allocated using devm_kzalloc and cleans now unnecessary kfrees in probe and remove functions. Also, the now unnecessary label out_err_hw_init is done away with and the label out_err_kzalloc is renamed to out_err. The following Coccinelle semantic patch was used for making the …

Continue reading