* [PATCH -next] HID: intel_ish-hid: Use kzalloc instead of kmalloc/memset
@ 2016-08-21 15:30 Wei Yongjun
2016-08-26 18:52 ` Srinivas Pandruvada
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-08-21 15:30 UTC (permalink / raw)
To: Srinivas Pandruvada, Jiri Kosina, Benjamin Tissoires
Cc: Wei Yongjun, linux-input
Use kzalloc rather than kmalloc followed by memset with 0.
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
drivers/hid/intel-ish-hid/ishtp/client-buffers.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/hid/intel-ish-hid/ishtp/client-buffers.c b/drivers/hid/intel-ish-hid/ishtp/client-buffers.c
index 3f5ce5e..b9b917d 100644
--- a/drivers/hid/intel-ish-hid/ishtp/client-buffers.c
+++ b/drivers/hid/intel-ish-hid/ishtp/client-buffers.c
@@ -73,11 +73,10 @@ int ishtp_cl_alloc_tx_ring(struct ishtp_cl *cl)
for (j = 0; j < cl->tx_ring_size; ++j) {
struct ishtp_cl_tx_ring *tx_buf;
- tx_buf = kmalloc(sizeof(struct ishtp_cl_tx_ring), GFP_KERNEL);
+ tx_buf = kzalloc(sizeof(struct ishtp_cl_tx_ring), GFP_KERNEL);
if (!tx_buf)
goto out;
- memset(tx_buf, 0, sizeof(struct ishtp_cl_tx_ring));
tx_buf->send_buf.data = kmalloc(len, GFP_KERNEL);
if (!tx_buf->send_buf.data) {
kfree(tx_buf);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] HID: intel_ish-hid: Use kzalloc instead of kmalloc/memset
2016-08-21 15:30 [PATCH -next] HID: intel_ish-hid: Use kzalloc instead of kmalloc/memset Wei Yongjun
@ 2016-08-26 18:52 ` Srinivas Pandruvada
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Pandruvada @ 2016-08-26 18:52 UTC (permalink / raw)
To: Wei Yongjun, Jiri Kosina, Benjamin Tissoires; +Cc: linux-input
On Sun, 2016-08-21 at 15:30 +0000, Wei Yongjun wrote:
> Use kzalloc rather than kmalloc followed by memset with 0.
>
> Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
>
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/hid/intel-ish-hid/ishtp/client-buffers.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/hid/intel-ish-hid/ishtp/client-buffers.c
> b/drivers/hid/intel-ish-hid/ishtp/client-buffers.c
> index 3f5ce5e..b9b917d 100644
> --- a/drivers/hid/intel-ish-hid/ishtp/client-buffers.c
> +++ b/drivers/hid/intel-ish-hid/ishtp/client-buffers.c
> @@ -73,11 +73,10 @@ int ishtp_cl_alloc_tx_ring(struct ishtp_cl *cl)
> for (j = 0; j < cl->tx_ring_size; ++j) {
> struct ishtp_cl_tx_ring *tx_buf;
>
> - tx_buf = kmalloc(sizeof(struct ishtp_cl_tx_ring),
> GFP_KERNEL);
> + tx_buf = kzalloc(sizeof(struct ishtp_cl_tx_ring),
> GFP_KERNEL);
> if (!tx_buf)
> goto out;
>
> - memset(tx_buf, 0, sizeof(struct ishtp_cl_tx_ring));
> tx_buf->send_buf.data = kmalloc(len, GFP_KERNEL);
> if (!tx_buf->send_buf.data) {
> kfree(tx_buf);
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-26 19:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-21 15:30 [PATCH -next] HID: intel_ish-hid: Use kzalloc instead of kmalloc/memset Wei Yongjun
2016-08-26 18:52 ` Srinivas Pandruvada
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.