diff mbox series

[-next] drm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_transfer()

Message ID 1543471233-159568-1-git-send-email-yuehaibing@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] drm/tinydrm: Use kmemdup rather than duplicating its implementation in repaper_spi_transfer() | expand

Commit Message

Yue Haibing Nov. 29, 2018, 6 a.m. UTC
use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/gpu/drm/tinydrm/repaper.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Noralf Trønnes Dec. 4, 2018, 3 p.m. UTC | #1
Den 29.11.2018 07.00, skrev YueHaibing:
> use kmemdup rather than duplicating its implementation
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---

Thanks, applied to drm-misc-next.

Noralf.

>   drivers/gpu/drm/tinydrm/repaper.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
> index 07f45a0..54d6fe0 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) {
>
>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tinydrm/repaper.c b/drivers/gpu/drm/tinydrm/repaper.c
index 07f45a0..54d6fe0 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) {