linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] platform/chrome: wilco_ec: Use kmemdup in enqueue_events()
@ 2019-06-21 13:59 YueHaibing
  2019-06-21 14:50 ` Nick Crews
  0 siblings, 1 reply; 4+ messages in thread
From: YueHaibing @ 2019-06-21 13:59 UTC (permalink / raw)
  To: Benson Leung, Enric Balletbo i Serra, Nick Crews
  Cc: YueHaibing, linux-kernel, kernel-janitors

Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/platform/chrome/wilco_ec/event.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/wilco_ec/event.c b/drivers/platform/chrome/wilco_ec/event.c
index c975b76e6255..70156e75047e 100644
--- a/drivers/platform/chrome/wilco_ec/event.c
+++ b/drivers/platform/chrome/wilco_ec/event.c
@@ -248,10 +248,9 @@ static int enqueue_events(struct acpi_device *adev, const u8 *buf, u32 length)
 		offset += event_size;
 
 		/* Copy event into the queue */
-		queue_event = kzalloc(event_size, GFP_KERNEL);
+		queue_event = kmemdup(event, event_size, GFP_KERNEL);
 		if (!queue_event)
 			return -ENOMEM;
-		memcpy(queue_event, event, event_size);
 		event_queue_push(dev_data->events, queue_event);
 	}




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-27 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-21 13:59 [PATCH -next] platform/chrome: wilco_ec: Use kmemdup in enqueue_events() YueHaibing
2019-06-21 14:50 ` Nick Crews
2019-09-26 22:43   ` Benson Leung
2019-09-27 17:06     ` Nick Crews

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).