From patchwork Sun Aug 21 15:30:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9292229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6DC13600CB for ; Sun, 21 Aug 2016 15:31:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60D02289E1 for ; Sun, 21 Aug 2016 15:31:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55442289E4; Sun, 21 Aug 2016 15:31:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA0EB289E1 for ; Sun, 21 Aug 2016 15:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753190AbcHUPbS (ORCPT ); Sun, 21 Aug 2016 11:31:18 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34294 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753176AbcHUPbR (ORCPT ); Sun, 21 Aug 2016 11:31:17 -0400 Received: by mail-pa0-f68.google.com with SMTP id hh10so6550251pac.1 for ; Sun, 21 Aug 2016 08:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ROut4VKPuM6TThnAntxAfKguv4aocLBz7CI8SnpjPKc=; b=xcvHUsw6CSrJDytQkDRiU255z6k7vmqEtx6VSmFx+8WwQ14+luBA1K1Qqcp7mFytJg 5S4jnwsw4srbXIB3hRyQTRGLx0FHVPajali+FQg/XK/jn1ii+f4rgf7YHsTmiCe2lG/I aTGIIxUsrUE8c5RuwZl519S1BItbM0JTdtd2xiALdz5uTA3BiF/jaJhBw1QYHYyjIv5P cIz1NYqI7O46hlA3IiUOn0y/j5g69dD96fHOIBRGLqFJq1igeeN9L4XPF6+ohcBfy99H 2EbEBNo43Yd54sKjctOLdS2HbErFQXl0N6+GJWzSSYuztp9MxmuBsstO8NN+YWffljsn 0zUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ROut4VKPuM6TThnAntxAfKguv4aocLBz7CI8SnpjPKc=; b=hFwsNR7umWtvUFrKpv/ryRDBvw+1yvQTdDrR1ceaVwnzohpvilQs80cWMHxLBENaDF Uhr2jFNNJTgOcuW2sSQjHRLDxpFwZjeHM4mkUKqK9ulH4YP94NJ5CBBMw98tD5A0yL2n DJ2wr9w5I73v8IChgsOF/+7hGh/8eDJiRKutV1ikguzgufHJ2H6FVGTKKhas2m9ThRCE 0K8o0p3JscXuRJy4/Rgr9EBPcq17chsDpkbMDD0lPl78Ogu0jIHFJBY3kspViJ36XVJl D7yKEoc1euHba0ezoZbQZus+U/xTQPZEzl8Nlp6ugqfv8g1YoUWPemr5bwWJzo9LTOus fKuw== X-Gm-Message-State: AEkoouti7OmbEM+68WvgENoZ5V2c7PPayt4tjnRpFdWFwloxqqGU4dcjXO3BaDqshePrGw== X-Received: by 10.66.229.9 with SMTP id sm9mr33179718pac.138.1471793475003; Sun, 21 Aug 2016 08:31:15 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id k66sm20837391pfc.30.2016.08.21.08.31.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Aug 2016 08:31:14 -0700 (PDT) From: Wei Yongjun To: Srinivas Pandruvada , Jiri Kosina , Benjamin Tissoires Cc: Wei Yongjun , linux-input@vger.kernel.org Subject: [PATCH -next] HID: intel_ish-hid: Use kzalloc instead of kmalloc/memset Date: Sun, 21 Aug 2016 15:30:50 +0000 Message-Id: <1471793450-24245-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use kzalloc rather than kmalloc followed by memset with 0. Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Signed-off-by: Wei Yongjun Acked-by: Srinivas Pandruvada --- drivers/hid/intel-ish-hid/ishtp/client-buffers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);