From patchwork Tue Sep 12 11:19:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 812793 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NQxLzkYR"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xs2Q46qwlz9sRg for ; Tue, 12 Sep 2017 21:19:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751422AbdILLTo (ORCPT ); Tue, 12 Sep 2017 07:19:44 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33178 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbdILLTn (ORCPT ); Tue, 12 Sep 2017 07:19:43 -0400 Received: by mail-pg0-f66.google.com with SMTP id i130so4011221pgc.0; Tue, 12 Sep 2017 04:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TmnCL/6l8F/CcLlRxdh7Atjo54z7oVqwlF0lFmiP8Ks=; b=NQxLzkYR1i/lyiu3iMzkrFbrOoDnCC1C79lHkLFP/wXKWYG0lqM851bdT+s5SYnkkJ Te9lZWveXNYrtGRt7WlfpH0yf/f6WaEj/3teRrp/Zr3M/2b8RQKyRsATYFQqYDQv2SBq p/uCDTtqk643EMKMrwdn/uU2lbtIEvfqgO38fNFjDnozryOw2eGwpmsHs12xWOBXQhUi WXJHIZ3Gh8lP0hrVHuPQ/E64A4Mpxh8Oeyuy3IJUNmpoYmmYvdOcV9iR4qdHDhc5uMep MJuhsahUBIrHNg7KZSuwGa5wrCN/58Otd0+voyNGmDVVPVcqsaZkh/QnKznr7UCAQoSs +jmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TmnCL/6l8F/CcLlRxdh7Atjo54z7oVqwlF0lFmiP8Ks=; b=Gi0FVNs+biWa9zE+8qttbvkMKcwQ0JDrLkG3xf+//FCFykOlVfiieyFomcV8ifzoga fmDIzPqeubi8uYvS/U/GFJuvruZjhSGWgTHsK+ERAqgazWkPXM1p9x7FtNPazbT7Ppvt QR0vBcKg2OpobWZ24KXbIxnIPpMsrbfta/9+dkVFMM0fVO/H5duCgrmVBEnHXBtK6nsl n/9YCLu42NTU/l7EIluOich5mpe9MG0Sro9KRgtT+KDVDmMDNEb7+2xSgPLq09ZNf69l 1B3w94CXrSBuY+gEgPEmgAJ73sjs5BnNtQiFWRancfpQjnUHwJa5zyNhsBVYDG8BEVcA 9Tlw== X-Gm-Message-State: AHPjjUhq2NyU/EQ/hvlItUQxqZLJ1h5p1DIXoZFlzt8hn5CvxokD0SUc EkAlIPU1cfRl0Q== X-Google-Smtp-Source: ADKCNb5s8/X4o3Kc2SOhTMiMtxXItPwgogJtuhSxuJbkFt6k+MeJs8GQEq8XRq3YyOsZeI4BdzwjMA== X-Received: by 10.84.232.135 with SMTP id i7mr17339299plk.104.1505215182702; Tue, 12 Sep 2017 04:19:42 -0700 (PDT) Received: from localhost.localdomain ([103.254.204.108]) by smtp.gmail.com with ESMTPSA id h1sm13156754pgp.37.2017.09.12.04.19.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Sep 2017 04:19:41 -0700 (PDT) From: Himanshu Jha To: Yuval.Mintz@cavium.com Cc: Ariel.Elior@cavium.com, everest-linux-l2@cavium.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Himanshu Jha Subject: [PATCH] qed: remove unnecessary call to memset Date: Tue, 12 Sep 2017 16:49:22 +0530 Message-Id: <1505215162-3917-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org call to memset to assign 0 value immediately after allocating memory with kzalloc is unnecesaary as kzalloc allocates the memory filled with 0 value. Semantic patch used to resolve this issue: @@ expression e,e2; constant c; statement S; @@ e = kzalloc(e2, c); if(e == NULL) S - memset(e, 0, e2); Signed-off-by: Himanshu Jha Signed-off-by: Himanshu Jha Acked-by: Sudarsana Kalluru --- drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c index eaca457..8f6ccc0 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c @@ -1244,7 +1244,6 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn, if (!dcbx_info) return -ENOMEM; - memset(dcbx_info, 0, sizeof(*dcbx_info)); rc = qed_dcbx_query_params(p_hwfn, dcbx_info, QED_DCBX_OPERATIONAL_MIB); if (rc) { kfree(dcbx_info);