From: YueHaibing Date: Thu, 29 Nov 2018 06:00:33 +0000 (+0000) Subject: drm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_tr... X-Git-Tag: v5.0-rc1~185^2~5^2~1 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=5ff75c489ce0466744684f5a549dd79f4ba697ca;p=linux.git drm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_transfer() use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing Signed-off-by: Noralf Trønnes Link: https://patchwork.freedesktop.org/patch/msgid/1543471233-159568-1-git-send-email-yuehaibing@huawei.com --- diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c index 07f45a008a0f..54d6fe0f37ce 100644 --- a/drivers/gpu/drm/tinydrm/repaper.c +++ b/drivers/gpu/drm/tinydrm/repaper.c @@ -108,12 +108,11 @@ static int repaper_spi_transfer(struct spi_device *spi, u8 header, /* Stack allocated tx? */ if (tx && len <= 32) { - txbuf = kmalloc(len, GFP_KERNEL); + txbuf = kmemdup(tx, len, GFP_KERNEL); if (!txbuf) { ret = -ENOMEM; goto out_free; } - memcpy(txbuf, tx, len); } if (rx) {