[PATCH] drivers: parport: Use kmemdup
Used kmemdup instead of kmalloc and memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/parport/parport_gsc.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c index 050773c..4b364c6 100644 --- a/drivers/parport/parport_gsc.c +++ b/drivers/parport/parport_gsc.c @@ -246,14 +246,14 @@ struct parport *parport_gsc_probe_port(unsigned long base, printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base); return NULL; } - ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL); + ops = kmemdup(_gsc_ops, sizeof(struct parport_operations), + GFP_KERNEL); if (!ops) { printk (KERN_DEBUG "parport (0x%lx): no memory for ops!\n", base); kfree (priv); return NULL; } - memcpy (ops, _gsc_ops, sizeof (struct parport_operations)); priv->ctr = 0xc; priv->ctr_writable = 0xff; priv->dma_buf = 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: parport: Use kzalloc
Replaced calls to kmalloc and memset with kzalloc. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/parport/share.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/parport/share.c b/drivers/parport/share.c index a848e02..6a83ee1 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c @@ -282,14 +282,13 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma, int device; char *name; - tmp = kmalloc(sizeof(struct parport), GFP_KERNEL); + tmp = kzalloc(sizeof(struct parport), GFP_KERNEL); if (!tmp) { printk(KERN_WARNING "parport: memory squeeze\n"); return NULL; } /* Init our structure */ - memset(tmp, 0, sizeof(struct parport)); tmp->base = base; tmp->irq = irq; tmp->dma = dma; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: parport: Use kzalloc
Replaced calls to kmalloc and memset with kzalloc. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/parport/share.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/parport/share.c b/drivers/parport/share.c index a848e02..6a83ee1 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c @@ -282,14 +282,13 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma, int device; char *name; - tmp = kmalloc(sizeof(struct parport), GFP_KERNEL); + tmp = kzalloc(sizeof(struct parport), GFP_KERNEL); if (!tmp) { printk(KERN_WARNING parport: memory squeeze\n); return NULL; } /* Init our structure */ - memset(tmp, 0, sizeof(struct parport)); tmp-base = base; tmp-irq = irq; tmp-dma = dma; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: parport: Use kmemdup
Used kmemdup instead of kmalloc and memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/parport/parport_gsc.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c index 050773c..4b364c6 100644 --- a/drivers/parport/parport_gsc.c +++ b/drivers/parport/parport_gsc.c @@ -246,14 +246,14 @@ struct parport *parport_gsc_probe_port(unsigned long base, printk (KERN_DEBUG parport (0x%lx): no memory!\n, base); return NULL; } - ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL); + ops = kmemdup(parport_gsc_ops, sizeof(struct parport_operations), + GFP_KERNEL); if (!ops) { printk (KERN_DEBUG parport (0x%lx): no memory for ops!\n, base); kfree (priv); return NULL; } - memcpy (ops, parport_gsc_ops, sizeof (struct parport_operations)); priv-ctr = 0xc; priv-ctr_writable = 0xff; priv-dma_buf = 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: reiserfs: Use kstrdup function
Use kstrdup function instead of kmalloc and strcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- fs/reiserfs/super.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 194113b..f8a23c3 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -1147,8 +1147,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin "on filesystem root."); return 0; } - qf_names[qtype] = - kmalloc(strlen(arg) + 1, GFP_KERNEL); + qf_names[qtype] = kstrdup(arg, GFP_KERNEL); if (!qf_names[qtype]) { reiserfs_warning(s, "reiserfs-2502", "not enough memory " @@ -1156,7 +1155,6 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin "quotafile name."); return 0; } - strcpy(qf_names[qtype], arg); if (qtype == USRQUOTA) *mount_options |= 1 << REISERFS_USRQUOTA; else -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: usb: gadget: Use ERR_CAST function
Use ERR_CAST function instead of ERR_PTR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/usb/gadget/composite.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 7c821de..5b73a74 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1138,7 +1138,7 @@ struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev, uc = copy_gadget_strings(sp, n_gstrings, n_strings); if (IS_ERR(uc)) - return ERR_PTR(PTR_ERR(uc)); + return ERR_CAST(uc); n_gs = get_containers_gs(uc); ret = usb_string_ids_tab(cdev, n_gs[0]->strings); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] lib: digsig: Use ERR_CAST function
Use ERR_CAST function instead of ERR_PTR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- lib/digsig.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/digsig.c b/lib/digsig.c index 2f31e6a..8793aed 100644 --- a/lib/digsig.c +++ b/lib/digsig.c @@ -209,7 +209,7 @@ int digsig_verify(struct key *keyring, const char *sig, int siglen, kref = keyring_search(make_key_ref(keyring, 1UL), _type_user, name); if (IS_ERR(kref)) - key = ERR_PTR(PTR_ERR(kref)); + key = ERR_CAST(kref); else key = key_ref_to_ptr(kref); } else { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: dma: Use devm_request_and_ioremap
Use devm_request_and_ioremap function which provides more consistent error handling. Signed-off-by: Alexandru Gheorghiu --- drivers/dma/txx9dmac.c |6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index 913f55c..471f9f1 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -1217,11 +1217,7 @@ static int __init txx9dmac_probe(struct platform_device *pdev) if (!ddev) return -ENOMEM; - if (!devm_request_mem_region(>dev, io->start, resource_size(io), -dev_name(>dev))) - return -EBUSY; - - ddev->regs = devm_ioremap(>dev, io->start, resource_size(io)); + ddev->regs = devm_request_and_ioremap(>dev, io); if (!ddev->regs) return -ENOMEM; ddev->have_64bit_regs = pdata->have_64bit_regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: dma: Use devm_request_and_ioremap
Use devm_request_and_ioremap function which provides more consistent error handling. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/dma/txx9dmac.c |6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index 913f55c..471f9f1 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c @@ -1217,11 +1217,7 @@ static int __init txx9dmac_probe(struct platform_device *pdev) if (!ddev) return -ENOMEM; - if (!devm_request_mem_region(pdev-dev, io-start, resource_size(io), -dev_name(pdev-dev))) - return -EBUSY; - - ddev-regs = devm_ioremap(pdev-dev, io-start, resource_size(io)); + ddev-regs = devm_request_and_ioremap(pdev-dev, io); if (!ddev-regs) return -ENOMEM; ddev-have_64bit_regs = pdata-have_64bit_regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] lib: digsig: Use ERR_CAST function
Use ERR_CAST function instead of ERR_PTR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- lib/digsig.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/digsig.c b/lib/digsig.c index 2f31e6a..8793aed 100644 --- a/lib/digsig.c +++ b/lib/digsig.c @@ -209,7 +209,7 @@ int digsig_verify(struct key *keyring, const char *sig, int siglen, kref = keyring_search(make_key_ref(keyring, 1UL), key_type_user, name); if (IS_ERR(kref)) - key = ERR_PTR(PTR_ERR(kref)); + key = ERR_CAST(kref); else key = key_ref_to_ptr(kref); } else { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: usb: gadget: Use ERR_CAST function
Use ERR_CAST function instead of ERR_PTR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/usb/gadget/composite.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 7c821de..5b73a74 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1138,7 +1138,7 @@ struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev, uc = copy_gadget_strings(sp, n_gstrings, n_strings); if (IS_ERR(uc)) - return ERR_PTR(PTR_ERR(uc)); + return ERR_CAST(uc); n_gs = get_containers_gs(uc); ret = usb_string_ids_tab(cdev, n_gs[0]-strings); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: reiserfs: Use kstrdup function
Use kstrdup function instead of kmalloc and strcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- fs/reiserfs/super.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 194113b..f8a23c3 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -1147,8 +1147,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin on filesystem root.); return 0; } - qf_names[qtype] = - kmalloc(strlen(arg) + 1, GFP_KERNEL); + qf_names[qtype] = kstrdup(arg, GFP_KERNEL); if (!qf_names[qtype]) { reiserfs_warning(s, reiserfs-2502, not enough memory @@ -1156,7 +1155,6 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin quotafile name.); return 0; } - strcpy(qf_names[qtype], arg); if (qtype == USRQUOTA) *mount_options |= 1 REISERFS_USRQUOTA; else -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] block: ioctl: Use PTR_RET function
Use PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- block/ioctl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/ioctl.c b/block/ioctl.c index a31d91d..4698c1f7 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -64,7 +64,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user part = add_partition(disk, partno, start, length, ADDPART_FLAG_NONE, NULL); mutex_unlock(>bd_mutex); - return IS_ERR(part) ? PTR_ERR(part) : 0; + return PTR_RET(part); case BLKPG_DEL_PARTITION: part = disk_get_part(disk, partno); if (!part) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] block: blk-timeout: Use PTR_RET function
Use PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- block/blk-timeout.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 6e4744c..2a6aba0 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -31,7 +31,7 @@ static int __init fail_io_timeout_debugfs(void) struct dentry *dir = fault_create_debugfs_attr("fail_io_timeout", NULL, _io_timeout); - return IS_ERR(dir) ? PTR_ERR(dir) : 0; + return PTR_RET(dir); } late_initcall(fail_io_timeout_debugfs); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] block: blk-core: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- block/blk-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 074b758..3a85a55 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1622,7 +1622,7 @@ static int __init fail_make_request_debugfs(void) struct dentry *dir = fault_create_debugfs_attr("fail_make_request", NULL, _make_request); - return IS_ERR(dir) ? PTR_ERR(dir) : 0; + return PTR_RET(dir); } late_initcall(fail_make_request_debugfs); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] block: blk-core: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- block/blk-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 074b758..3a85a55 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1622,7 +1622,7 @@ static int __init fail_make_request_debugfs(void) struct dentry *dir = fault_create_debugfs_attr(fail_make_request, NULL, fail_make_request); - return IS_ERR(dir) ? PTR_ERR(dir) : 0; + return PTR_RET(dir); } late_initcall(fail_make_request_debugfs); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] block: blk-timeout: Use PTR_RET function
Use PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- block/blk-timeout.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 6e4744c..2a6aba0 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -31,7 +31,7 @@ static int __init fail_io_timeout_debugfs(void) struct dentry *dir = fault_create_debugfs_attr(fail_io_timeout, NULL, fail_io_timeout); - return IS_ERR(dir) ? PTR_ERR(dir) : 0; + return PTR_RET(dir); } late_initcall(fail_io_timeout_debugfs); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] block: ioctl: Use PTR_RET function
Use PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- block/ioctl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/ioctl.c b/block/ioctl.c index a31d91d..4698c1f7 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -64,7 +64,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user part = add_partition(disk, partno, start, length, ADDPART_FLAG_NONE, NULL); mutex_unlock(bdev-bd_mutex); - return IS_ERR(part) ? PTR_ERR(part) : 0; + return PTR_RET(part); case BLKPG_DEL_PARTITION: part = disk_get_part(disk, partno); if (!part) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: f2fs: Use kmemdup
Use kmemdup instead of kzalloc and memcpy. Signed-off-by: Alexandru Gheorghiu --- fs/f2fs/node.c| 12 +--- fs/f2fs/segment.c |3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e275218..9f5eca4 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1661,19 +1661,17 @@ static int init_node_manager(struct f2fs_sb_info *sbi) spin_lock_init(_i->free_nid_list_lock); rwlock_init(_i->nat_tree_lock); - nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); nm_i->init_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); nm_i->next_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); - - nm_i->nat_bitmap = kzalloc(nm_i->bitmap_size, GFP_KERNEL); - if (!nm_i->nat_bitmap) - return -ENOMEM; + nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); version_bitmap = __bitmap_ptr(sbi, NAT_BITMAP); if (!version_bitmap) return -EFAULT; - /* copy version bitmap */ - memcpy(nm_i->nat_bitmap, version_bitmap, nm_i->bitmap_size); + nm_i->nat_bitmap = kmemdup(version_bitmap, nm_i->bitmap_size, + GFP_KERNEL); + if (!nm_i->nat_bitmap) + return -ENOMEM; return 0; } diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 777f17e..1758149 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1403,10 +1403,9 @@ static int build_sit_info(struct f2fs_sb_info *sbi) bitmap_size = __bitmap_size(sbi, SIT_BITMAP); src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); - dst_bitmap = kzalloc(bitmap_size, GFP_KERNEL); + dst_bitmap = kmemdup(src_bitmap, bitmap_size, GFP_KERNEL); if (!dst_bitmap) return -ENOMEM; - memcpy(dst_bitmap, src_bitmap, bitmap_size); /* init SIT information */ sit_i->s_ops = _salloc_ops; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: f2fs: Use kmemdup
Use kmemdup instead of kzalloc and memcpy. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- fs/f2fs/node.c| 12 +--- fs/f2fs/segment.c |3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e275218..9f5eca4 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1661,19 +1661,17 @@ static int init_node_manager(struct f2fs_sb_info *sbi) spin_lock_init(nm_i-free_nid_list_lock); rwlock_init(nm_i-nat_tree_lock); - nm_i-bitmap_size = __bitmap_size(sbi, NAT_BITMAP); nm_i-init_scan_nid = le32_to_cpu(sbi-ckpt-next_free_nid); nm_i-next_scan_nid = le32_to_cpu(sbi-ckpt-next_free_nid); - - nm_i-nat_bitmap = kzalloc(nm_i-bitmap_size, GFP_KERNEL); - if (!nm_i-nat_bitmap) - return -ENOMEM; + nm_i-bitmap_size = __bitmap_size(sbi, NAT_BITMAP); version_bitmap = __bitmap_ptr(sbi, NAT_BITMAP); if (!version_bitmap) return -EFAULT; - /* copy version bitmap */ - memcpy(nm_i-nat_bitmap, version_bitmap, nm_i-bitmap_size); + nm_i-nat_bitmap = kmemdup(version_bitmap, nm_i-bitmap_size, + GFP_KERNEL); + if (!nm_i-nat_bitmap) + return -ENOMEM; return 0; } diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 777f17e..1758149 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1403,10 +1403,9 @@ static int build_sit_info(struct f2fs_sb_info *sbi) bitmap_size = __bitmap_size(sbi, SIT_BITMAP); src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); - dst_bitmap = kzalloc(bitmap_size, GFP_KERNEL); + dst_bitmap = kmemdup(src_bitmap, bitmap_size, GFP_KERNEL); if (!dst_bitmap) return -ENOMEM; - memcpy(dst_bitmap, src_bitmap, bitmap_size); /* init SIT information */ sit_i-s_ops = default_salloc_ops; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: f2fs: Use kmemdup
Used kmemdup instead of kzalloc and memcpy. Signed-off-by: Alexandru Gheorghiu --- fs/f2fs/node.c| 11 --- fs/f2fs/segment.c |3 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e275218..920f53a 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1661,19 +1661,16 @@ static int init_node_manager(struct f2fs_sb_info *sbi) spin_lock_init(_i->free_nid_list_lock); rwlock_init(_i->nat_tree_lock); - nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); nm_i->init_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); nm_i->next_scan_nid = le32_to_cpu(sbi->ckpt->next_free_nid); - - nm_i->nat_bitmap = kzalloc(nm_i->bitmap_size, GFP_KERNEL); - if (!nm_i->nat_bitmap) - return -ENOMEM; + nm_i->bitmap_size = __bitmap_size(sbi, NAT_BITMAP); version_bitmap = __bitmap_ptr(sbi, NAT_BITMAP); if (!version_bitmap) return -EFAULT; - /* copy version bitmap */ - memcpy(nm_i->nat_bitmap, version_bitmap, nm_i->bitmap_size); + nm_i->nat_bitmap = kmemdup(version_bitmap, nm_i->bitmap_size, GFP_KERNEL); + if (!nm_i->nat_bitmap) + return -ENOMEM; return 0; } diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 777f17e..1758149 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1403,10 +1403,9 @@ static int build_sit_info(struct f2fs_sb_info *sbi) bitmap_size = __bitmap_size(sbi, SIT_BITMAP); src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); - dst_bitmap = kzalloc(bitmap_size, GFP_KERNEL); + dst_bitmap = kmemdup(src_bitmap, bitmap_size, GFP_KERNEL); if (!dst_bitmap) return -ENOMEM; - memcpy(dst_bitmap, src_bitmap, bitmap_size); /* init SIT information */ sit_i->s_ops = _salloc_ops; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: f2fs: Use kmemdup
Used kmemdup instead of kzalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- fs/f2fs/segment.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 777f17e..1758149 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1403,10 +1403,9 @@ static int build_sit_info(struct f2fs_sb_info *sbi) bitmap_size = __bitmap_size(sbi, SIT_BITMAP); src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); - dst_bitmap = kzalloc(bitmap_size, GFP_KERNEL); + dst_bitmap = kmemdup(src_bitmap, bitmap_size, GFP_KERNEL); if (!dst_bitmap) return -ENOMEM; - memcpy(dst_bitmap, src_bitmap, bitmap_size); /* init SIT information */ sit_i->s_ops = _salloc_ops; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: f2fs: Use kmemdup
Used kmemdup instead of kzalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- fs/f2fs/segment.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 777f17e..1758149 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1403,10 +1403,9 @@ static int build_sit_info(struct f2fs_sb_info *sbi) bitmap_size = __bitmap_size(sbi, SIT_BITMAP); src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); - dst_bitmap = kzalloc(bitmap_size, GFP_KERNEL); + dst_bitmap = kmemdup(src_bitmap, bitmap_size, GFP_KERNEL); if (!dst_bitmap) return -ENOMEM; - memcpy(dst_bitmap, src_bitmap, bitmap_size); /* init SIT information */ sit_i-s_ops = default_salloc_ops; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: f2fs: Use kmemdup
Used kmemdup instead of kzalloc and memcpy. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- fs/f2fs/node.c| 11 --- fs/f2fs/segment.c |3 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e275218..920f53a 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1661,19 +1661,16 @@ static int init_node_manager(struct f2fs_sb_info *sbi) spin_lock_init(nm_i-free_nid_list_lock); rwlock_init(nm_i-nat_tree_lock); - nm_i-bitmap_size = __bitmap_size(sbi, NAT_BITMAP); nm_i-init_scan_nid = le32_to_cpu(sbi-ckpt-next_free_nid); nm_i-next_scan_nid = le32_to_cpu(sbi-ckpt-next_free_nid); - - nm_i-nat_bitmap = kzalloc(nm_i-bitmap_size, GFP_KERNEL); - if (!nm_i-nat_bitmap) - return -ENOMEM; + nm_i-bitmap_size = __bitmap_size(sbi, NAT_BITMAP); version_bitmap = __bitmap_ptr(sbi, NAT_BITMAP); if (!version_bitmap) return -EFAULT; - /* copy version bitmap */ - memcpy(nm_i-nat_bitmap, version_bitmap, nm_i-bitmap_size); + nm_i-nat_bitmap = kmemdup(version_bitmap, nm_i-bitmap_size, GFP_KERNEL); + if (!nm_i-nat_bitmap) + return -ENOMEM; return 0; } diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 777f17e..1758149 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1403,10 +1403,9 @@ static int build_sit_info(struct f2fs_sb_info *sbi) bitmap_size = __bitmap_size(sbi, SIT_BITMAP); src_bitmap = __bitmap_ptr(sbi, SIT_BITMAP); - dst_bitmap = kzalloc(bitmap_size, GFP_KERNEL); + dst_bitmap = kmemdup(src_bitmap, bitmap_size, GFP_KERNEL); if (!dst_bitmap) return -ENOMEM; - memcpy(dst_bitmap, src_bitmap, bitmap_size); /* init SIT information */ sit_i-s_ops = default_salloc_ops; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: dlm: Use kmemdup
Use kmemdup instead of kmalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- fs/dlm/lowcomms.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 4f5ad24..bfd6fbc 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1213,10 +1213,9 @@ static void init_local(void) if (dlm_our_addr(, i)) break; - addr = kmalloc(sizeof(*addr), GFP_NOFS); + addr = kmemdup(, sizeof(*addr), GFP_NOFS); if (!addr) break; - memcpy(addr, , sizeof(*addr)); dlm_local_addr[dlm_local_count++] = addr; } } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: dlm: Use kmemdup
Use kmemdup instead of kmalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- fs/dlm/lowcomms.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 4f5ad24..bfd6fbc 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1213,10 +1213,9 @@ static void init_local(void) if (dlm_our_addr(sas, i)) break; - addr = kmalloc(sizeof(*addr), GFP_NOFS); + addr = kmemdup(sas, sizeof(*addr), GFP_NOFS); if (!addr) break; - memcpy(addr, sas, sizeof(*addr)); dlm_local_addr[dlm_local_count++] = addr; } } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: soc: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- sound/soc/soc-io.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index 29183ef..8ca9ecc 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c @@ -158,10 +158,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, return -EINVAL; } - if (IS_ERR(codec->control_data)) - return PTR_ERR(codec->control_data); - - return 0; + return PTR_RET(codec->control_data); } EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); #else -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy
Used kmemdup instead of replicating it's behaviour with kmalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- sound/oss/sb_common.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c index 7d42c54..851a1da 100644 --- a/sound/oss/sb_common.c +++ b/sound/oss/sb_common.c @@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_ */ - detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL); + detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL); if (detected_devc == NULL) { printk(KERN_ERR "sb: Can't allocate memory for device information\n"); return 0; } - memcpy(detected_devc, devc, sizeof(sb_devc)); MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base)); return 1; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: oss: uart401: Used kmemdup instead of kmalloc and memcpy
Used kmemdup instead of replicating it's behaviour with kmalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- sound/oss/uart401.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c index 8e514a6..5433c6f 100644 --- a/sound/oss/uart401.c +++ b/sound/oss/uart401.c @@ -352,23 +352,26 @@ int probe_uart401(struct address_info *hw_config, struct module *owner) goto cleanup_irq; } conf_printf(name, hw_config); - midi_devs[devc->my_dev] = kmalloc(sizeof(struct midi_operations), GFP_KERNEL); + midi_devs[devc->my_dev] = kmemdup(_operations, + sizeof(struct midi_operations), + GFP_KERNEL); if (!midi_devs[devc->my_dev]) { printk(KERN_ERR "uart401: Failed to allocate memory\n"); goto cleanup_unload_mididev; } - memcpy(midi_devs[devc->my_dev], _operations, sizeof(struct midi_operations)); if (owner) midi_devs[devc->my_dev]->owner = owner; midi_devs[devc->my_dev]->devc = devc; - midi_devs[devc->my_dev]->converter = kmalloc(sizeof(struct synth_operations), GFP_KERNEL); + midi_devs[devc->my_dev]->converter = kmemdup(_midi_synth, +sizeof(struct synth_operations), +GFP_KERNEL); + if (!midi_devs[devc->my_dev]->converter) { printk(KERN_WARNING "uart401: Failed to allocate memory\n"); goto cleanup_midi_devs; } - memcpy(midi_devs[devc->my_dev]->converter, _midi_synth, sizeof(struct synth_operations)); strcpy(midi_devs[devc->my_dev]->info.name, name); midi_devs[devc->my_dev]->converter->id = "UART401"; midi_devs[devc->my_dev]->converter->midi_dev = devc->my_dev; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: virtio: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/virtio/virtio_mmio.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 1ba0d68..d1e664f 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -567,10 +567,7 @@ static int vm_cmdline_set(const char *device, pdev = platform_device_register_resndata(_cmdline_parent, "virtio-mmio", vm_cmdline_id++, resources, ARRAY_SIZE(resources), NULL, 0); - if (IS_ERR(pdev)) - return PTR_ERR(pdev); - - return 0; + return PTR_RET(pdev); } static int vm_cmdline_get_device(struct device *dev, void *data) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: virtio: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/virtio/virtio_mmio.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 1ba0d68..d1e664f 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -567,10 +567,7 @@ static int vm_cmdline_set(const char *device, pdev = platform_device_register_resndata(vm_cmdline_parent, virtio-mmio, vm_cmdline_id++, resources, ARRAY_SIZE(resources), NULL, 0); - if (IS_ERR(pdev)) - return PTR_ERR(pdev); - - return 0; + return PTR_RET(pdev); } static int vm_cmdline_get_device(struct device *dev, void *data) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: oss: uart401: Used kmemdup instead of kmalloc and memcpy
Used kmemdup instead of replicating it's behaviour with kmalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- sound/oss/uart401.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c index 8e514a6..5433c6f 100644 --- a/sound/oss/uart401.c +++ b/sound/oss/uart401.c @@ -352,23 +352,26 @@ int probe_uart401(struct address_info *hw_config, struct module *owner) goto cleanup_irq; } conf_printf(name, hw_config); - midi_devs[devc-my_dev] = kmalloc(sizeof(struct midi_operations), GFP_KERNEL); + midi_devs[devc-my_dev] = kmemdup(uart401_operations, + sizeof(struct midi_operations), + GFP_KERNEL); if (!midi_devs[devc-my_dev]) { printk(KERN_ERR uart401: Failed to allocate memory\n); goto cleanup_unload_mididev; } - memcpy(midi_devs[devc-my_dev], uart401_operations, sizeof(struct midi_operations)); if (owner) midi_devs[devc-my_dev]-owner = owner; midi_devs[devc-my_dev]-devc = devc; - midi_devs[devc-my_dev]-converter = kmalloc(sizeof(struct synth_operations), GFP_KERNEL); + midi_devs[devc-my_dev]-converter = kmemdup(std_midi_synth, +sizeof(struct synth_operations), +GFP_KERNEL); + if (!midi_devs[devc-my_dev]-converter) { printk(KERN_WARNING uart401: Failed to allocate memory\n); goto cleanup_midi_devs; } - memcpy(midi_devs[devc-my_dev]-converter, std_midi_synth, sizeof(struct synth_operations)); strcpy(midi_devs[devc-my_dev]-info.name, name); midi_devs[devc-my_dev]-converter-id = UART401; midi_devs[devc-my_dev]-converter-midi_dev = devc-my_dev; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: oss: sb_common: Used kmemdup instead of kmalloc and memcpy
Used kmemdup instead of replicating it's behaviour with kmalloc followed by memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- sound/oss/sb_common.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c index 7d42c54..851a1da 100644 --- a/sound/oss/sb_common.c +++ b/sound/oss/sb_common.c @@ -626,13 +626,12 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_ */ - detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL); + detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL); if (detected_devc == NULL) { printk(KERN_ERR sb: Can't allocate memory for device information\n); return 0; } - memcpy(detected_devc, devc, sizeof(sb_devc)); MDB(printk(KERN_INFO SB %d.%02d detected OK (%x)\n, devc-major, devc-minor, hw_config-io_base)); return 1; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: soc: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- sound/soc/soc-io.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index 29183ef..8ca9ecc 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c @@ -158,10 +158,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, return -EINVAL; } - if (IS_ERR(codec-control_data)) - return PTR_ERR(codec-control_data); - - return 0; + return PTR_RET(codec-control_data); } EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); #else -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: video: omap2: dss: Use PTR_RET function
Use PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/video/omap2/dss/core.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index f8779d4..60cc6fe 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -181,10 +181,7 @@ int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, write, _debug_fops); - if (IS_ERR(d)) - return PTR_ERR(d); - - return 0; + return PTR_RET(d); } #else /* CONFIG_OMAP2_DSS_DEBUGFS */ static inline int dss_initialize_debugfs(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: message: fusion: Use memdup_user function
Used memdup_user function instead of kmalloc and copy_from_user. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/message/fusion/mptctl.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index b383b69..2669e83 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -1268,19 +1268,12 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) else return -EFAULT; - karg = kmalloc(data_size, GFP_KERNEL); - if (karg == NULL) { - printk(KERN_ERR MYNAM "%s::mpt_ioctl_iocinfo() @%d - no memory available!\n", - __FILE__, __LINE__); - return -ENOMEM; - } - - if (copy_from_user(karg, uarg, data_size)) { + karg = memdup_user(uarg, data_size); + if (IS_ERR(karg)) { printk(KERN_ERR MYNAM "%s@%d::mptctl_getiocinfo - " "Unable to read in mpt_ioctl_iocinfo struct @ %p\n", __FILE__, __LINE__, uarg); - kfree(karg); - return -EFAULT; + return PTR_ERR(karg); } if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, )) < 0) || -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: message: fusion: Use kmemdup function
Used kmemdup function instead of kmalloc and memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/message/fusion/mptbase.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index fb69baa..d2bae18 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -6004,13 +6004,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) if (mpt_config(ioc, ) != 0) goto out; - mem = kmalloc(iocpage2sz, GFP_KERNEL); + mem = kmemdup((u8 *)pIoc2, iocpage2sz, GFP_KERNEL); if (!mem) { rc = -ENOMEM; goto out; } - memcpy(mem, (u8 *)pIoc2, iocpage2sz); ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem; mpt_read_ioc_pg_3(ioc); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: message: i2o: Use kstrdup function
Use kstrdup instead kmalloc and strcpy. Patch found using coccinelle Signed-off-by: Alexandru Gheorghiu --- drivers/message/i2o/memory.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/i2o/memory.c b/drivers/message/i2o/memory.c index 292b41e..1741a59 100644 --- a/drivers/message/i2o/memory.c +++ b/drivers/message/i2o/memory.c @@ -270,10 +270,9 @@ EXPORT_SYMBOL_GPL(i2o_dma_realloc); int i2o_pool_alloc(struct i2o_pool *pool, const char *name, size_t size, int min_nr) { - pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL); + pool->name = kstrdup(name, GFP_KERNEL); if (!pool->name) goto exit; - strcpy(pool->name, name); pool->slab = kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: platform: x86: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/platform/x86/samsung-q10.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c index 5f77005..1a90b62 100644 --- a/drivers/platform/x86/samsung-q10.c +++ b/drivers/platform/x86/samsung-q10.c @@ -176,10 +176,7 @@ static int __init samsungq10_init(void) samsungq10_probe, NULL, 0, NULL, 0); - if (IS_ERR(samsungq10_device)) - return PTR_ERR(samsungq10_device); - - return 0; + return PTR_RET(samsungq10_device); } static void __exit samsungq10_exit(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: platform: x86: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/platform/x86/samsung-q10.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c index 5f77005..1a90b62 100644 --- a/drivers/platform/x86/samsung-q10.c +++ b/drivers/platform/x86/samsung-q10.c @@ -176,10 +176,7 @@ static int __init samsungq10_init(void) samsungq10_probe, NULL, 0, NULL, 0); - if (IS_ERR(samsungq10_device)) - return PTR_ERR(samsungq10_device); - - return 0; + return PTR_RET(samsungq10_device); } static void __exit samsungq10_exit(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: message: i2o: Use kstrdup function
Use kstrdup instead kmalloc and strcpy. Patch found using coccinelle Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/message/i2o/memory.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/i2o/memory.c b/drivers/message/i2o/memory.c index 292b41e..1741a59 100644 --- a/drivers/message/i2o/memory.c +++ b/drivers/message/i2o/memory.c @@ -270,10 +270,9 @@ EXPORT_SYMBOL_GPL(i2o_dma_realloc); int i2o_pool_alloc(struct i2o_pool *pool, const char *name, size_t size, int min_nr) { - pool-name = kmalloc(strlen(name) + 1, GFP_KERNEL); + pool-name = kstrdup(name, GFP_KERNEL); if (!pool-name) goto exit; - strcpy(pool-name, name); pool-slab = kmem_cache_create(pool-name, size, 0, SLAB_HWCACHE_ALIGN, NULL); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: message: fusion: Use kmemdup function
Used kmemdup function instead of kmalloc and memcpy. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/message/fusion/mptbase.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index fb69baa..d2bae18 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -6004,13 +6004,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) if (mpt_config(ioc, cfg) != 0) goto out; - mem = kmalloc(iocpage2sz, GFP_KERNEL); + mem = kmemdup((u8 *)pIoc2, iocpage2sz, GFP_KERNEL); if (!mem) { rc = -ENOMEM; goto out; } - memcpy(mem, (u8 *)pIoc2, iocpage2sz); ioc-raid_data.pIocPg2 = (IOCPage2_t *) mem; mpt_read_ioc_pg_3(ioc); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: message: fusion: Use memdup_user function
Used memdup_user function instead of kmalloc and copy_from_user. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/message/fusion/mptctl.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index b383b69..2669e83 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c @@ -1268,19 +1268,12 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) else return -EFAULT; - karg = kmalloc(data_size, GFP_KERNEL); - if (karg == NULL) { - printk(KERN_ERR MYNAM %s::mpt_ioctl_iocinfo() @%d - no memory available!\n, - __FILE__, __LINE__); - return -ENOMEM; - } - - if (copy_from_user(karg, uarg, data_size)) { + karg = memdup_user(uarg, data_size); + if (IS_ERR(karg)) { printk(KERN_ERR MYNAM %s@%d::mptctl_getiocinfo - Unable to read in mpt_ioctl_iocinfo struct @ %p\n, __FILE__, __LINE__, uarg); - kfree(karg); - return -EFAULT; + return PTR_ERR(karg); } if (((iocnum = mpt_verify_adapter(karg-hdr.iocnum, ioc)) 0) || -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: video: omap2: dss: Use PTR_RET function
Use PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/video/omap2/dss/core.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index f8779d4..60cc6fe 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -181,10 +181,7 @@ int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, write, dss_debug_fops); - if (IS_ERR(d)) - return PTR_ERR(d); - - return 0; + return PTR_RET(d); } #else /* CONFIG_OMAP2_DSS_DEBUGFS */ static inline int dss_initialize_debugfs(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: ptp: Use memdup_user function
Used memdup_user function instead of kmalloc followed by copy_from_user. Also, handled return error using IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/ptp/ptp_chardev.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 34a0c60..bd7a2ab 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -94,14 +94,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) break; case PTP_SYS_OFFSET: - sysoff = kmalloc(sizeof(*sysoff), GFP_KERNEL); - if (!sysoff) { - err = -ENOMEM; - break; - } - if (copy_from_user(sysoff, (void __user *)arg, - sizeof(*sysoff))) { - err = -EFAULT; + sysoff = memdup_user((void __user *)arg, sizeof(*sysoff)); + if (IS_ERR(sysoff)) { + err = PTR_ERR(sysoff); break; } if (sysoff->n_samples > PTP_MAX_SAMPLES) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: regulator: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/regulator/fan53555.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 9165b0c..f0e1ae5 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -219,9 +219,7 @@ static int fan53555_regulator_register(struct fan53555_device_info *di, rdesc->owner = THIS_MODULE; di->rdev = regulator_register(>desc, config); - if (IS_ERR(di->rdev)) - return PTR_ERR(di->rdev); - return 0; + return PTR_RET(di->rdev); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: bluetooth: Replaced kzalloc and memcpy with kmemdup
Replaced calls to kzalloc followed by memcpy with a single call to kmemdup. Signed-off-by: Alexandru Gheorghiu --- net/bluetooth/a2mp.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index eb0f4b1..17f33a6 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c @@ -397,13 +397,12 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, if (ctrl) { u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(rsp->amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, rsp->amp_assoc, assoc_len); ctrl->assoc = assoc; ctrl->assoc_len = assoc_len; ctrl->assoc_rem_len = assoc_len; @@ -472,13 +471,12 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req); u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(req->amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, req->amp_assoc, assoc_len); ctrl->assoc = assoc; ctrl->assoc_len = assoc_len; ctrl->assoc_rem_len = assoc_len; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: bluetooth: Replaced kzalloc and memcpy with kmemdup
Replaced calls to kzalloc followed by memcpy with a single call to kmemdup. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- net/bluetooth/a2mp.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index eb0f4b1..17f33a6 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c @@ -397,13 +397,12 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, if (ctrl) { u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(rsp-amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, rsp-amp_assoc, assoc_len); ctrl-assoc = assoc; ctrl-assoc_len = assoc_len; ctrl-assoc_rem_len = assoc_len; @@ -472,13 +471,12 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, size_t assoc_len = le16_to_cpu(hdr-len) - sizeof(*req); u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(req-amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, req-amp_assoc, assoc_len); ctrl-assoc = assoc; ctrl-assoc_len = assoc_len; ctrl-assoc_rem_len = assoc_len; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: regulator: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/regulator/fan53555.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 9165b0c..f0e1ae5 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -219,9 +219,7 @@ static int fan53555_regulator_register(struct fan53555_device_info *di, rdesc-owner = THIS_MODULE; di-rdev = regulator_register(di-desc, config); - if (IS_ERR(di-rdev)) - return PTR_ERR(di-rdev); - return 0; + return PTR_RET(di-rdev); } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: ptp: Use memdup_user function
Used memdup_user function instead of kmalloc followed by copy_from_user. Also, handled return error using IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/ptp/ptp_chardev.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 34a0c60..bd7a2ab 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -94,14 +94,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) break; case PTP_SYS_OFFSET: - sysoff = kmalloc(sizeof(*sysoff), GFP_KERNEL); - if (!sysoff) { - err = -ENOMEM; - break; - } - if (copy_from_user(sysoff, (void __user *)arg, - sizeof(*sysoff))) { - err = -EFAULT; + sysoff = memdup_user((void __user *)arg, sizeof(*sysoff)); + if (IS_ERR(sysoff)) { + err = PTR_ERR(sysoff); break; } if (sysoff-n_samples PTP_MAX_SAMPLES) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: cpuidle: Use devm_ioremap_resource function
Use devm_ioremap_resource function, which provides better error handling, instead of devm_request_and_ioremap. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/cpuidle/cpuidle-kirkwood.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c index 670aa1e..53aad73 100644 --- a/drivers/cpuidle/cpuidle-kirkwood.c +++ b/drivers/cpuidle/cpuidle-kirkwood.c @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev) if (res == NULL) return -EINVAL; - ddr_operation_base = devm_request_and_ioremap(>dev, res); - if (!ddr_operation_base) - return -EADDRNOTAVAIL; + ddr_operation_base = devm_ioremap_resource(>dev, res); + if (IS_ERR(ddr_operation_base)) + return PTR_ERR(ddr_operation_base); device = _cpu(kirkwood_cpuidle_device, smp_processor_id()); device->state_count = KIRKWOOD_MAX_STATES; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: ata: Use resource_size function
Use resource_size function instead of explicit computation. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/ata/pata_octeon_cf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index ff2e57f..e73bef3 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c @@ -926,7 +926,7 @@ static int octeon_cf_probe(struct platform_device *pdev) goto free_cf_port; } cs1 = devm_ioremap_nocache(>dev, res_cs1->start, - res_cs1->end - res_cs1->start + 1); + resource_size(res_cs1)); if (!cs1) goto free_cf_port; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: char: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/char/tile-srom.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c index 3b22a60..2e2036e 100644 --- a/drivers/char/tile-srom.c +++ b/drivers/char/tile-srom.c @@ -371,7 +371,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index) dev = device_create(srom_class, _bus, MKDEV(srom_major, index), srom, "%d", index); - return IS_ERR(dev) ? PTR_ERR(dev) : 0; + return PTR_RET(dev); } /** srom_init() - Initialize the driver's module. */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: char: ipmi: Replaced kmalloc and strcpy with kstrdup
Replaced calls to kmalloc followed by strcpy with a sincle call to kstrdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/char/ipmi/ipmi_msghandler.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 053201b..617b443 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -2037,12 +2037,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, entry = kmalloc(sizeof(*entry), GFP_KERNEL); if (!entry) return -ENOMEM; - entry->name = kmalloc(strlen(name)+1, GFP_KERNEL); + entry->name = kstrdup(name, GFP_KERNEL); if (!entry->name) { kfree(entry); return -ENOMEM; } - strcpy(entry->name, name); file = proc_create_data(name, 0, smi->proc_dir, proc_ops, data); if (!file) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: bluetooth: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- net/bluetooth/hci_sysfs.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 23b4e24..ff38561 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -590,10 +590,8 @@ int __init bt_sysfs_init(void) bt_debugfs = debugfs_create_dir("bluetooth", NULL); bt_class = class_create(THIS_MODULE, "bluetooth"); - if (IS_ERR(bt_class)) - return PTR_ERR(bt_class); - return 0; + return PTR_RET(bt_class); } void bt_sysfs_cleanup(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: bluetooth: Replaced kzalloc and memcpy with kmemdup
Replaced calls to kzalloc followed by memcpy with a single call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- net/bluetooth/a2mp.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index eb0f4b1..140e81c 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c @@ -397,13 +397,12 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, if (ctrl) { u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(rsp->amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, rsp->amp_assoc, assoc_len); ctrl->assoc = assoc; ctrl->assoc_len = assoc_len; ctrl->assoc_rem_len = assoc_len; @@ -472,13 +471,12 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req); u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(rep->amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, req->amp_assoc, assoc_len); ctrl->assoc = assoc; ctrl->assoc_len = assoc_len; ctrl->assoc_rem_len = assoc_len; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: bluetooth: Replaced kzalloc and memcpy with kmemdup
Replaced calls to kzalloc followed by memcpy with a single call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- net/bluetooth/a2mp.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index eb0f4b1..140e81c 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c @@ -397,13 +397,12 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb, if (ctrl) { u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(rsp-amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, rsp-amp_assoc, assoc_len); ctrl-assoc = assoc; ctrl-assoc_len = assoc_len; ctrl-assoc_rem_len = assoc_len; @@ -472,13 +471,12 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, size_t assoc_len = le16_to_cpu(hdr-len) - sizeof(*req); u8 *assoc; - assoc = kzalloc(assoc_len, GFP_KERNEL); + assoc = kmemdup(rep-amp_assoc, assoc_len, GFP_KERNEL); if (!assoc) { amp_ctrl_put(ctrl); return -ENOMEM; } - memcpy(assoc, req-amp_assoc, assoc_len); ctrl-assoc = assoc; ctrl-assoc_len = assoc_len; ctrl-assoc_rem_len = assoc_len; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: bluetooth: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- net/bluetooth/hci_sysfs.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 23b4e24..ff38561 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -590,10 +590,8 @@ int __init bt_sysfs_init(void) bt_debugfs = debugfs_create_dir(bluetooth, NULL); bt_class = class_create(THIS_MODULE, bluetooth); - if (IS_ERR(bt_class)) - return PTR_ERR(bt_class); - return 0; + return PTR_RET(bt_class); } void bt_sysfs_cleanup(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: char: ipmi: Replaced kmalloc and strcpy with kstrdup
Replaced calls to kmalloc followed by strcpy with a sincle call to kstrdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/char/ipmi/ipmi_msghandler.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 053201b..617b443 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -2037,12 +2037,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, entry = kmalloc(sizeof(*entry), GFP_KERNEL); if (!entry) return -ENOMEM; - entry-name = kmalloc(strlen(name)+1, GFP_KERNEL); + entry-name = kstrdup(name, GFP_KERNEL); if (!entry-name) { kfree(entry); return -ENOMEM; } - strcpy(entry-name, name); file = proc_create_data(name, 0, smi-proc_dir, proc_ops, data); if (!file) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: char: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/char/tile-srom.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c index 3b22a60..2e2036e 100644 --- a/drivers/char/tile-srom.c +++ b/drivers/char/tile-srom.c @@ -371,7 +371,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index) dev = device_create(srom_class, platform_bus, MKDEV(srom_major, index), srom, %d, index); - return IS_ERR(dev) ? PTR_ERR(dev) : 0; + return PTR_RET(dev); } /** srom_init() - Initialize the driver's module. */ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: ata: Use resource_size function
Use resource_size function instead of explicit computation. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/ata/pata_octeon_cf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index ff2e57f..e73bef3 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c @@ -926,7 +926,7 @@ static int octeon_cf_probe(struct platform_device *pdev) goto free_cf_port; } cs1 = devm_ioremap_nocache(pdev-dev, res_cs1-start, - res_cs1-end - res_cs1-start + 1); + resource_size(res_cs1)); if (!cs1) goto free_cf_port; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: cpuidle: Use devm_ioremap_resource function
Use devm_ioremap_resource function, which provides better error handling, instead of devm_request_and_ioremap. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/cpuidle/cpuidle-kirkwood.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/cpuidle-kirkwood.c b/drivers/cpuidle/cpuidle-kirkwood.c index 670aa1e..53aad73 100644 --- a/drivers/cpuidle/cpuidle-kirkwood.c +++ b/drivers/cpuidle/cpuidle-kirkwood.c @@ -66,9 +66,9 @@ static int kirkwood_cpuidle_probe(struct platform_device *pdev) if (res == NULL) return -EINVAL; - ddr_operation_base = devm_request_and_ioremap(pdev-dev, res); - if (!ddr_operation_base) - return -EADDRNOTAVAIL; + ddr_operation_base = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(ddr_operation_base)) + return PTR_ERR(ddr_operation_base); device = per_cpu(kirkwood_cpuidle_device, smp_processor_id()); device-state_count = KIRKWOOD_MAX_STATES; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: dns_resolver: Use kmemdup instead of kmalloc and memcpy
Replace use of kmalloc followed by memcpy with kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- net/dns_resolver/dns_query.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c index c32be29..4ac62fb 100644 --- a/net/dns_resolver/dns_query.c +++ b/net/dns_resolver/dns_query.c @@ -146,11 +146,10 @@ int dns_query(const char *type, const char *name, size_t namelen, len = upayload->datalen; ret = -ENOMEM; - *_result = kmalloc(len + 1, GFP_KERNEL); + *_result = kmemdup(upayload->data, len + 1, GFP_KERNEL); if (!*_result) goto put; - memcpy(*_result, upayload->data, len + 1); if (_expiry) *_expiry = rkey->expiry; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net: dns_resolver: Use kmemdup instead of kmalloc and memcpy
Replace use of kmalloc followed by memcpy with kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- net/dns_resolver/dns_query.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c index c32be29..4ac62fb 100644 --- a/net/dns_resolver/dns_query.c +++ b/net/dns_resolver/dns_query.c @@ -146,11 +146,10 @@ int dns_query(const char *type, const char *name, size_t namelen, len = upayload-datalen; ret = -ENOMEM; - *_result = kmalloc(len + 1, GFP_KERNEL); + *_result = kmemdup(upayload-data, len + 1, GFP_KERNEL); if (!*_result) goto put; - memcpy(*_result, upayload-data, len + 1); if (_expiry) *_expiry = rkey-expiry; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpio: Use devm_ioremap_resource function
Use the newly introduced devm_ioremap_resource() instead of devm_request_and_ioremap() which provides more consistent error handling. Signed-off-by: Alexandru Gheorghiu --- drivers/gpio/gpio-vt8500.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-vt8500.c b/drivers/gpio/gpio-vt8500.c index 81683ca..eaed4ac 100644 --- a/drivers/gpio/gpio-vt8500.c +++ b/drivers/gpio/gpio-vt8500.c @@ -309,10 +309,10 @@ static int vt8500_gpio_probe(struct platform_device *pdev) return -ENODEV; } - gpio_base = devm_request_and_ioremap(>dev, res); - if (!gpio_base) { + gpio_base = devm_ioremap_resource(>dev, res); + if (IS_ERR(gpio_base)) { dev_err(>dev, "Unable to map GPIO registers\n"); - return -ENOMEM; + return PTR_ERR(gpio_base); } ret = vt8500_add_chips(pdev, gpio_base, of_id->data); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: spi: Use PTR_RET function
Replaced calls to IS_ERR and PTR_ERR with PTR_RET function. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/spi/spidev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 2e0655d..911e9e0 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -603,7 +603,7 @@ static int spidev_probe(struct spi_device *spi) dev = device_create(spidev_class, >dev, spidev->devt, spidev, "spidev%d.%d", spi->master->bus_num, spi->chip_select); - status = IS_ERR(dev) ? PTR_ERR(dev) : 0; + status = PTR_RET(dev); } else { dev_dbg(>dev, "no minor number available!\n"); status = -ENODEV; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: spi: Use PTR_RET function
Replaced calls to IS_ERR and PTR_ERR with PTR_RET function. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/spi/spi-fsl-spi.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 086a9ee..1985ba3 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -1134,9 +1134,7 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev) return -EINVAL; master = fsl_spi_probe(>dev, mem, irq); - if (IS_ERR(master)) - return PTR_ERR(master); - return 0; + return PTR_RET(master); } static int plat_mpc8xxx_spi_remove(struct platform_device *pdev) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: spi: Use PTR_RET function
Replaced calls to IS_ERR and PTR_ERR with PTR_RET function. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/spi/spi-fsl-spi.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 086a9ee..1985ba3 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -1134,9 +1134,7 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev) return -EINVAL; master = fsl_spi_probe(pdev-dev, mem, irq); - if (IS_ERR(master)) - return PTR_ERR(master); - return 0; + return PTR_RET(master); } static int plat_mpc8xxx_spi_remove(struct platform_device *pdev) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: spi: Use PTR_RET function
Replaced calls to IS_ERR and PTR_ERR with PTR_RET function. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/spi/spidev.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 2e0655d..911e9e0 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -603,7 +603,7 @@ static int spidev_probe(struct spi_device *spi) dev = device_create(spidev_class, spi-dev, spidev-devt, spidev, spidev%d.%d, spi-master-bus_num, spi-chip_select); - status = IS_ERR(dev) ? PTR_ERR(dev) : 0; + status = PTR_RET(dev); } else { dev_dbg(spi-dev, no minor number available!\n); status = -ENODEV; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpio: Use devm_ioremap_resource function
Use the newly introduced devm_ioremap_resource() instead of devm_request_and_ioremap() which provides more consistent error handling. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/gpio/gpio-vt8500.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-vt8500.c b/drivers/gpio/gpio-vt8500.c index 81683ca..eaed4ac 100644 --- a/drivers/gpio/gpio-vt8500.c +++ b/drivers/gpio/gpio-vt8500.c @@ -309,10 +309,10 @@ static int vt8500_gpio_probe(struct platform_device *pdev) return -ENODEV; } - gpio_base = devm_request_and_ioremap(pdev-dev, res); - if (!gpio_base) { + gpio_base = devm_ioremap_resource(pdev-dev, res); + if (IS_ERR(gpio_base)) { dev_err(pdev-dev, Unable to map GPIO registers\n); - return -ENOMEM; + return PTR_ERR(gpio_base); } ret = vt8500_add_chips(pdev, gpio_base, of_id-data); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: dma: Use devm_ioremap_resource
Replaced call to devm_request_and_ioremap with devm_ioremap_resource which provides better error handling. Signed-off-by: Alexandru Gheorghiu --- drivers/dma/pl330.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 7181531..c0a81fb 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2904,9 +2904,9 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pi->mcbufsz = pdat ? pdat->mcbuf_sz : 0; res = >res; - pi->base = devm_request_and_ioremap(>dev, res); - if (!pi->base) - return -ENXIO; + pi->base = devm_ioremap_resource(>dev, res); + if (IS_ERR(pi->base)) + return PTR_ERR(pi->base); amba_set_drvdata(adev, pdmac); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: mm: Removed useless label
Rewrote conditional statement and eliminated the out_kthread label. Signed-off-by: Alexandru Gheorghiu --- arch/s390/mm/cmm.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index 479e942..9d84a1f 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -458,12 +458,10 @@ static int __init cmm_init(void) if (rc) goto out_pm; cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread"); - rc = IS_ERR(cmm_thread_ptr) ? PTR_ERR(cmm_thread_ptr) : 0; - if (rc) - goto out_kthread; - return 0; + if (!IS_ERR(cmm_thread_ptr)) + return 0; -out_kthread: + rc = PTR_ERR(cmm_thread_ptr); unregister_pm_notifier(_power_notifier); out_pm: unregister_oom_notifier(_oom_nb); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: hypfs: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- arch/s390/hypfs/hypfs_dbfs.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c index 9fd4a40..bb5dd49 100644 --- a/arch/s390/hypfs/hypfs_dbfs.c +++ b/arch/s390/hypfs/hypfs_dbfs.c @@ -105,9 +105,7 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df) int hypfs_dbfs_init(void) { dbfs_dir = debugfs_create_dir("s390_hypfs", NULL); - if (IS_ERR(dbfs_dir)) - return PTR_ERR(dbfs_dir); - return 0; + return PTR_RET(dbfs_dir); } void hypfs_dbfs_exit(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: mm: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- arch/s390/mm/cmm.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index 479e942..5cf867f 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -458,7 +458,7 @@ static int __init cmm_init(void) if (rc) goto out_pm; cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread"); - rc = IS_ERR(cmm_thread_ptr) ? PTR_ERR(cmm_thread_ptr) : 0; + rc = PTR_RET(cmm_thread_ptr); if (rc) goto out_kthread; return 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: net: Replaced kmalloc and memset with kzalloc
Used kzalloc instead of kmalloc followed by memset with 0. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- arch/s390/net/bpf_jit_comp.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 0972e91..e645528 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -747,10 +747,9 @@ void bpf_jit_compile(struct sk_filter *fp) if (!bpf_jit_enable) return; - addrs = kmalloc(fp->len * sizeof(*addrs), GFP_KERNEL); + addrs = kzalloc(fp->len * sizeof(*addrs), GFP_KERNEL); if (addrs == NULL) return; - memset(addrs, 0, fp->len * sizeof(*addrs)); memset(, 0, sizeof(cjit)); memset(, 0, sizeof(cjit)); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: dma: Use devm_ioremap_resource
Replaced call to devm_request_and_ioremap with devm_ioremap_resource which provides better error handling. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/dma/pl330.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 7181531..c0a81fb 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2904,9 +2904,9 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pi-mcbufsz = pdat ? pdat-mcbuf_sz : 0; res = adev-res; - pi-base = devm_request_and_ioremap(adev-dev, res); - if (!pi-base) - return -ENXIO; + pi-base = devm_ioremap_resource(adev-dev, res); + if (IS_ERR(pi-base)) + return PTR_ERR(pi-base); amba_set_drvdata(adev, pdmac); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: net: Replaced kmalloc and memset with kzalloc
Used kzalloc instead of kmalloc followed by memset with 0. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- arch/s390/net/bpf_jit_comp.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 0972e91..e645528 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -747,10 +747,9 @@ void bpf_jit_compile(struct sk_filter *fp) if (!bpf_jit_enable) return; - addrs = kmalloc(fp-len * sizeof(*addrs), GFP_KERNEL); + addrs = kzalloc(fp-len * sizeof(*addrs), GFP_KERNEL); if (addrs == NULL) return; - memset(addrs, 0, fp-len * sizeof(*addrs)); memset(jit, 0, sizeof(cjit)); memset(cjit, 0, sizeof(cjit)); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: mm: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- arch/s390/mm/cmm.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index 479e942..5cf867f 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -458,7 +458,7 @@ static int __init cmm_init(void) if (rc) goto out_pm; cmm_thread_ptr = kthread_run(cmm_thread, NULL, cmmthread); - rc = IS_ERR(cmm_thread_ptr) ? PTR_ERR(cmm_thread_ptr) : 0; + rc = PTR_RET(cmm_thread_ptr); if (rc) goto out_kthread; return 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: hypfs: Use PTR_RET function
Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- arch/s390/hypfs/hypfs_dbfs.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c index 9fd4a40..bb5dd49 100644 --- a/arch/s390/hypfs/hypfs_dbfs.c +++ b/arch/s390/hypfs/hypfs_dbfs.c @@ -105,9 +105,7 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df) int hypfs_dbfs_init(void) { dbfs_dir = debugfs_create_dir(s390_hypfs, NULL); - if (IS_ERR(dbfs_dir)) - return PTR_ERR(dbfs_dir); - return 0; + return PTR_RET(dbfs_dir); } void hypfs_dbfs_exit(void) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arch: s390: mm: Removed useless label
Rewrote conditional statement and eliminated the out_kthread label. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- arch/s390/mm/cmm.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c index 479e942..9d84a1f 100644 --- a/arch/s390/mm/cmm.c +++ b/arch/s390/mm/cmm.c @@ -458,12 +458,10 @@ static int __init cmm_init(void) if (rc) goto out_pm; cmm_thread_ptr = kthread_run(cmm_thread, NULL, cmmthread); - rc = IS_ERR(cmm_thread_ptr) ? PTR_ERR(cmm_thread_ptr) : 0; - if (rc) - goto out_kthread; - return 0; + if (!IS_ERR(cmm_thread_ptr)) + return 0; -out_kthread: + rc = PTR_ERR(cmm_thread_ptr); unregister_pm_notifier(cmm_power_notifier); out_pm: unregister_oom_notifier(cmm_oom_nb); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: acpi: Used resource_size function
Used resource_size function instead of explicit computation. Signed-off-by: Alexandru Gheorghiu --- drivers/acpi/osl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 586e7e9..4d31748 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1555,7 +1555,7 @@ int acpi_check_resource_conflict(const struct resource *res) else space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY; - length = res->end - res->start + 1; + length = resource_size(res); if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) warn = 1; clash = acpi_check_address_range(space_id, res->start, length, warn); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: acpi: Used PTR_RET function
Used PTR_RET function instead of explicit checking with IS_ERR. Signed-off-by: Alexandru Gheorghiu --- drivers/acpi/acpi_pad.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 31de104..27bb6a9 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -236,7 +236,7 @@ static int create_power_saving_task(void) ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, (void *)(unsigned long)ps_tsk_num, "acpi_pad/%d", ps_tsk_num); - rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; + rc = PTR_RET(ps_tsks[ps_tsk_num]); if (!rc) ps_tsk_num++; else -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: acpi: Replaced kmalloc and memcpy with kmemdup
Replaced calls to kmalloc followed by memcpy with a single call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/acpi/bus.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 01708a1..6c8380e 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -288,13 +288,12 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) } out_success: context->ret.length = out_obj->buffer.length; - context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL); + context->ret.pointer = kmemdup(out_obj->buffer.pointer, + context->ret.length, GFP_KERNEL); if (!context->ret.pointer) { status = AE_NO_MEMORY; goto out_kfree; } - memcpy(context->ret.pointer, out_obj->buffer.pointer, - context->ret.length); status = AE_OK; out_kfree: -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: mmc: host: Use resource_size()
Used resource_size function instead of explicit computation. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/mmc/host/wmt-sdmmc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index 154f0e8..541e097 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -925,7 +925,7 @@ static int wmt_mci_remove(struct platform_device *pdev) clk_put(priv->clk_sdmmc); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, res->end - res->start + 1); + release_mem_region(res->start, resource_size(res)); mmc_free_host(mmc); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: mmc: host: Use resource_size()
Used resource_size function instead of explicit computation. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/mmc/host/wmt-sdmmc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index 154f0e8..541e097 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -925,7 +925,7 @@ static int wmt_mci_remove(struct platform_device *pdev) clk_put(priv-clk_sdmmc); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res-start, res-end - res-start + 1); + release_mem_region(res-start, resource_size(res)); mmc_free_host(mmc); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: acpi: Replaced kmalloc and memcpy with kmemdup
Replaced calls to kmalloc followed by memcpy with a single call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/acpi/bus.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 01708a1..6c8380e 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -288,13 +288,12 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) } out_success: context-ret.length = out_obj-buffer.length; - context-ret.pointer = kmalloc(context-ret.length, GFP_KERNEL); + context-ret.pointer = kmemdup(out_obj-buffer.pointer, + context-ret.length, GFP_KERNEL); if (!context-ret.pointer) { status = AE_NO_MEMORY; goto out_kfree; } - memcpy(context-ret.pointer, out_obj-buffer.pointer, - context-ret.length); status = AE_OK; out_kfree: -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: acpi: Used PTR_RET function
Used PTR_RET function instead of explicit checking with IS_ERR. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/acpi/acpi_pad.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 31de104..27bb6a9 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -236,7 +236,7 @@ static int create_power_saving_task(void) ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, (void *)(unsigned long)ps_tsk_num, acpi_pad/%d, ps_tsk_num); - rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; + rc = PTR_RET(ps_tsks[ps_tsk_num]); if (!rc) ps_tsk_num++; else -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: acpi: Used resource_size function
Used resource_size function instead of explicit computation. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/acpi/osl.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 586e7e9..4d31748 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1555,7 +1555,7 @@ int acpi_check_resource_conflict(const struct resource *res) else space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY; - length = res-end - res-start + 1; + length = resource_size(res); if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) warn = 1; clash = acpi_check_address_range(space_id, res-start, length, warn); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc & memcpy with kmemdup
Replaced calls to kmalloc followed by memcpy with a single call to kmemdup. Also removed a now redundant if statement. Signed-off-by: Alexandru Gheorghiu --- drivers/gpu/drm/i915/intel_dp.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f61cb79..3cf8aed 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -2335,11 +2335,8 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) return NULL; size = (intel_connector->edid->extensions + 1) * EDID_LENGTH; - edid = kmalloc(size, GFP_KERNEL); - if (!edid) - return NULL; + edid = kmemdup(intel_connector->edid, size, GFP_KERNEL); - memcpy(edid, intel_connector->edid, size); return edid; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: gma500: Replaced calls kzalloc & memcpy with kmemdup
Replaced calls kzalloc followed by memcpy with call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/gpu/drm/gma500/intel_bios.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/gma500/intel_bios.c b/drivers/gpu/drm/gma500/intel_bios.c index 403fffb..d349734 100644 --- a/drivers/gpu/drm/gma500/intel_bios.c +++ b/drivers/gpu/drm/gma500/intel_bios.c @@ -218,12 +218,11 @@ static void parse_backlight_data(struct drm_psb_private *dev_priv, bl_start = find_section(bdb, BDB_LVDS_BACKLIGHT); vbt_lvds_bl = (struct bdb_lvds_backlight *)(bl_start + 1) + p_type; - lvds_bl = kzalloc(sizeof(*vbt_lvds_bl), GFP_KERNEL); + lvds_bl = kmemdup(vbt_lvds_bl, sizeof(*vbt_lvds_bl), GFP_KERNEL); if (!lvds_bl) { dev_err(dev_priv->dev->dev, "out of memory for backlight data\n"); return; } - memcpy(lvds_bl, vbt_lvds_bl, sizeof(*vbt_lvds_bl)); dev_priv->lvds_bl = lvds_bl; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: Replaced ERR_PTR & PTR_ERR with ERR_CAST
Replaced ERR_PTR and PTR_ERR calls with ERR_CAST. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/gpu/drm/drm_prime.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 366910d..4c8adda 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -275,7 +275,7 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, attach = dma_buf_attach(dma_buf, dev->dev); if (IS_ERR(attach)) - return ERR_PTR(PTR_ERR(attach)); + return ERR_CAST(attach); sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); if (IS_ERR_OR_NULL(sgt)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc & memcpy with kmemdup
Replaced calls to kmalloc followed by memcpy with a single call to kmemdup. This patch was found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/gpu/drm/i915/intel_dp.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f61cb79..a3fdd65 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -2335,11 +2335,10 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) return NULL; size = (intel_connector->edid->extensions + 1) * EDID_LENGTH; - edid = kmalloc(size, GFP_KERNEL); + edid = kmemdup(intel_connector->edid, size, GFP_KERNEL); if (!edid) return NULL; - memcpy(edid, intel_connector->edid, size); return edid; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: exynos: Replaced kzalloc & memcpy with kmemdup
Replaced calls to kzalloc followed by memcpy with call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu --- drivers/gpu/drm/exynos/exynos_drm_vidi.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 13ccbd4..9504b0c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -117,13 +117,12 @@ static struct edid *vidi_get_edid(struct device *dev, } edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; - edid = kzalloc(edid_len, GFP_KERNEL); + edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL); if (!edid) { DRM_DEBUG_KMS("failed to allocate edid\n"); return ERR_PTR(-ENOMEM); } - memcpy(edid, ctx->raw_edid, edid_len); return edid; } @@ -563,12 +562,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, return -EINVAL; } edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; - ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); + ctx->raw_edid = kmemdup(raw_edid, edid_len, GFP_KERNEL); if (!ctx->raw_edid) { DRM_DEBUG_KMS("failed to allocate raw_edid.\n"); return -ENOMEM; } - memcpy(ctx->raw_edid, raw_edid, edid_len); } else { /* * with connection = 0, free raw_edid -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: exynos: Replaced kzalloc memcpy with kmemdup
Replaced calls to kzalloc followed by memcpy with call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/gpu/drm/exynos/exynos_drm_vidi.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 13ccbd4..9504b0c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -117,13 +117,12 @@ static struct edid *vidi_get_edid(struct device *dev, } edid_len = (1 + ctx-raw_edid-extensions) * EDID_LENGTH; - edid = kzalloc(edid_len, GFP_KERNEL); + edid = kmemdup(ctx-raw_edid, edid_len, GFP_KERNEL); if (!edid) { DRM_DEBUG_KMS(failed to allocate edid\n); return ERR_PTR(-ENOMEM); } - memcpy(edid, ctx-raw_edid, edid_len); return edid; } @@ -563,12 +562,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, return -EINVAL; } edid_len = (1 + raw_edid-extensions) * EDID_LENGTH; - ctx-raw_edid = kzalloc(edid_len, GFP_KERNEL); + ctx-raw_edid = kmemdup(raw_edid, edid_len, GFP_KERNEL); if (!ctx-raw_edid) { DRM_DEBUG_KMS(failed to allocate raw_edid.\n); return -ENOMEM; } - memcpy(ctx-raw_edid, raw_edid, edid_len); } else { /* * with connection = 0, free raw_edid -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc memcpy with kmemdup
Replaced calls to kmalloc followed by memcpy with a single call to kmemdup. This patch was found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/gpu/drm/i915/intel_dp.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f61cb79..a3fdd65 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -2335,11 +2335,10 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) return NULL; size = (intel_connector-edid-extensions + 1) * EDID_LENGTH; - edid = kmalloc(size, GFP_KERNEL); + edid = kmemdup(intel_connector-edid, size, GFP_KERNEL); if (!edid) return NULL; - memcpy(edid, intel_connector-edid, size); return edid; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: Replaced ERR_PTR PTR_ERR with ERR_CAST
Replaced ERR_PTR and PTR_ERR calls with ERR_CAST. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/gpu/drm/drm_prime.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 366910d..4c8adda 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -275,7 +275,7 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, attach = dma_buf_attach(dma_buf, dev-dev); if (IS_ERR(attach)) - return ERR_PTR(PTR_ERR(attach)); + return ERR_CAST(attach); sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); if (IS_ERR_OR_NULL(sgt)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: gma500: Replaced calls kzalloc memcpy with kmemdup
Replaced calls kzalloc followed by memcpy with call to kmemdup. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/gpu/drm/gma500/intel_bios.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/gma500/intel_bios.c b/drivers/gpu/drm/gma500/intel_bios.c index 403fffb..d349734 100644 --- a/drivers/gpu/drm/gma500/intel_bios.c +++ b/drivers/gpu/drm/gma500/intel_bios.c @@ -218,12 +218,11 @@ static void parse_backlight_data(struct drm_psb_private *dev_priv, bl_start = find_section(bdb, BDB_LVDS_BACKLIGHT); vbt_lvds_bl = (struct bdb_lvds_backlight *)(bl_start + 1) + p_type; - lvds_bl = kzalloc(sizeof(*vbt_lvds_bl), GFP_KERNEL); + lvds_bl = kmemdup(vbt_lvds_bl, sizeof(*vbt_lvds_bl), GFP_KERNEL); if (!lvds_bl) { dev_err(dev_priv-dev-dev, out of memory for backlight data\n); return; } - memcpy(lvds_bl, vbt_lvds_bl, sizeof(*vbt_lvds_bl)); dev_priv-lvds_bl = lvds_bl; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc memcpy with kmemdup
Replaced calls to kmalloc followed by memcpy with a single call to kmemdup. Also removed a now redundant if statement. Signed-off-by: Alexandru Gheorghiu gheorghiuan...@gmail.com --- drivers/gpu/drm/i915/intel_dp.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f61cb79..3cf8aed 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -2335,11 +2335,8 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) return NULL; size = (intel_connector-edid-extensions + 1) * EDID_LENGTH; - edid = kmalloc(size, GFP_KERNEL); - if (!edid) - return NULL; + edid = kmemdup(intel_connector-edid, size, GFP_KERNEL); - memcpy(edid, intel_connector-edid, size); return edid; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: btrfs: Replaced calls to kmalloc and memcpy with kmemdup
Replaced calls to kmalloc followed by memcpy with single call to kmemdup. This patch was found using coccicheck. Signed-off-by: Alexandru Gheorghiu --- fs/btrfs/send.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index f7a8b86..f1e1e34 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -3429,10 +3429,9 @@ static int __find_xattr(int num, struct btrfs_key *di_key, strncmp(name, ctx->name, name_len) == 0) { ctx->found_idx = num; ctx->found_data_len = data_len; - ctx->found_data = kmalloc(data_len, GFP_NOFS); + ctx->found_data = kmemdup(data, data_len, GFP_NOFS); if (!ctx->found_data) return -ENOMEM; - memcpy(ctx->found_data, data, data_len); return 1; } return 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: pstore: Replaced calls to kmalloc and memcpy with kmemdup
Replaced calls to kmalloc and memcpy with a single call to kmemdup. This patch was found using coccicheck. Signed-off-by: Alexandru Gheorghiu --- fs/pstore/ram.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 288f068..38babb3 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -156,10 +156,9 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, time->tv_nsec = 0; size = persistent_ram_old_size(prz); - *buf = kmalloc(size, GFP_KERNEL); + *buf = kmemdup(persistent_ram_old(prz), size, GFP_KERNEL); if (*buf == NULL) return -ENOMEM; - memcpy(*buf, persistent_ram_old(prz), size); return size; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/