drm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_transfer()
use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/1543471233-159568-1-git-send-email-yuehaibing@huawei.com
This commit is contained in:
parent
77e9c35acd
commit
5ff75c489c
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue