hsi: use kmemdup
[deliverable/linux.git] / drivers / hsi / hsi.c
index df380d55c58fc916c35c8a680aab2e28f86a1584..d7ce07ad67f3df3e704375ced8c18f8e5d308db3 100644 (file)
@@ -90,19 +90,19 @@ struct hsi_client *hsi_new_client(struct hsi_port *port,
        cl->tx_cfg = info->tx_cfg;
        if (cl->tx_cfg.channels) {
                size = cl->tx_cfg.num_channels * sizeof(*cl->tx_cfg.channels);
-               cl->tx_cfg.channels = kzalloc(size , GFP_KERNEL);
+               cl->tx_cfg.channels = kmemdup(info->tx_cfg.channels, size,
+                                             GFP_KERNEL);
                if (!cl->tx_cfg.channels)
                        goto err_tx;
-               memcpy(cl->tx_cfg.channels, info->tx_cfg.channels, size);
        }
 
        cl->rx_cfg = info->rx_cfg;
        if (cl->rx_cfg.channels) {
                size = cl->rx_cfg.num_channels * sizeof(*cl->rx_cfg.channels);
-               cl->rx_cfg.channels = kzalloc(size , GFP_KERNEL);
+               cl->rx_cfg.channels = kmemdup(info->rx_cfg.channels, size,
+                                             GFP_KERNEL);
                if (!cl->rx_cfg.channels)
                        goto err_rx;
-               memcpy(cl->rx_cfg.channels, info->rx_cfg.channels, size);
        }
 
        cl->device.bus = &hsi_bus_type;
This page took 0.053159 seconds and 5 git commands to generate.