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:
Родитель
77e9c35acd
Коммит
5ff75c489c
|
@ -108,12 +108,11 @@ static int repaper_spi_transfer(struct spi_device *spi, u8 header,
|
||||||
|
|
||||||
/* Stack allocated tx? */
|
/* Stack allocated tx? */
|
||||||
if (tx && len <= 32) {
|
if (tx && len <= 32) {
|
||||||
txbuf = kmalloc(len, GFP_KERNEL);
|
txbuf = kmemdup(tx, len, GFP_KERNEL);
|
||||||
if (!txbuf) {
|
if (!txbuf) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
memcpy(txbuf, tx, len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rx) {
|
if (rx) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче