Skip to content

Commit

Permalink
HID: intel_ish-hid: Use kzalloc instead of kmalloc/memset
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Wei Yongjun authored and Jiri Kosina committed Aug 29, 2016
1 parent e8c6113 commit 6cf5c1c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/hid/intel-ish-hid/ishtp/client-buffers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6cf5c1c

Please sign in to comment.