Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2643c47f authored by Peter Huewe's avatar Peter Huewe Committed by Greg Kroah-Hartman
Browse files

staging/csr: Use kmemdup rather than duplicating its implementation



Found with coccicheck.
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d662b8eb
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -820,14 +820,14 @@ unifi_write(struct file *filp, const char *p, size_t len, loff_t *poff)
                    sig_id, signal_size);
                    sig_id, signal_size);


	/* Allocate a buffer for the signal */
	/* Allocate a buffer for the signal */
        signal_buf = kmalloc(signal_size, GFP_KERNEL);
	signal_buf = kmemdup(bulkdata.d[0].os_data_ptr, signal_size,
				GFP_KERNEL);
        if (!signal_buf) {
        if (!signal_buf) {
            unifi_net_data_free(priv, &bulkdata.d[0]);
            unifi_net_data_free(priv, &bulkdata.d[0]);
            return -ENOMEM;
            return -ENOMEM;
        }
        }


        /* Get the signal from the os_data_ptr */
        /* Get the signal from the os_data_ptr */
        memcpy(signal_buf, bulkdata.d[0].os_data_ptr, signal_size);
        signal_buf[5] = (pcli->sender_id >> 8) & 0xff;
        signal_buf[5] = (pcli->sender_id >> 8) & 0xff;


        if (signal_size < len) {
        if (signal_size < len) {