Commit bfe89d72 authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Stefan Richter

drivers/ieee1394/*: use kmemdup()

Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 5f8d17f6
...@@ -1078,10 +1078,9 @@ static struct unit_directory *nodemgr_process_unit_directory ...@@ -1078,10 +1078,9 @@ static struct unit_directory *nodemgr_process_unit_directory
/* Logical Unit Number */ /* Logical Unit Number */
if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
if (ud->flags & UNIT_DIRECTORY_HAS_LUN) { if (ud->flags & UNIT_DIRECTORY_HAS_LUN) {
ud_child = kmalloc(sizeof(*ud_child), GFP_KERNEL); ud_child = kmemdup(ud, sizeof(*ud_child), GFP_KERNEL);
if (!ud_child) if (!ud_child)
goto unit_directory_error; goto unit_directory_error;
memcpy(ud_child, ud, sizeof(*ud_child));
nodemgr_register_device(ne, ud_child, &ne->device); nodemgr_register_device(ne, ud_child, &ne->device);
ud_child = NULL; ud_child = NULL;
......
...@@ -1428,10 +1428,9 @@ static int __devinit add_card(struct pci_dev *dev, ...@@ -1428,10 +1428,9 @@ static int __devinit add_card(struct pci_dev *dev,
struct i2c_algo_bit_data i2c_adapter_data; struct i2c_algo_bit_data i2c_adapter_data;
error = -ENOMEM; error = -ENOMEM;
i2c_ad = kmalloc(sizeof(*i2c_ad), GFP_KERNEL); i2c_ad = kmemdup(&bit_ops, sizeof(*i2c_ad), GFP_KERNEL);
if (!i2c_ad) FAIL("failed to allocate I2C adapter memory"); if (!i2c_ad) FAIL("failed to allocate I2C adapter memory");
memcpy(i2c_ad, &bit_ops, sizeof(struct i2c_adapter));
i2c_adapter_data = bit_data; i2c_adapter_data = bit_data;
i2c_ad->algo_data = &i2c_adapter_data; i2c_ad->algo_data = &i2c_adapter_data;
i2c_adapter_data.data = lynx; i2c_adapter_data.data = lynx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment