Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp947527rwj; Sat, 29 Oct 2022 13:48:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TQzsZjhO7ZTfgNe9IRrVcY5PvzJD02+eNLC/HbqNwo86lV8dWoq8Mvxgsoie/ah+8Zbjh X-Received: by 2002:a17:902:c40d:b0:186:ffe6:24cc with SMTP id k13-20020a170902c40d00b00186ffe624ccmr6294064plk.133.1667076491796; Sat, 29 Oct 2022 13:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667076491; cv=none; d=google.com; s=arc-20160816; b=K8Ms+t5yQs1ZaemHox19nzdIvy6uAtVbzHwPBUXk4XwoZ3eMMrjz6jyXGbARIka5N7 VHEeI6y1wcnWjELXCgHVHPoSZP35fD9ifr3tqKKm2dD/+5rDSSsh63L9f2sSZ/Xf7n1k 43DRyvbKjBQb5P8Nw02iykWMk2JOdyh916wnDmFy5VDXKWYQOgZIJRKAWfgI5A0HH5DS NBcijbdOPkDDjUw6Q87aIErpV0VUyZpscYZALO3K7/P3hMW51u66H5cBkeOXzc0lHH1/ 4CZ7fqtJxBgUXqYBJlE1N0KkZkRC6eRJ6Xh/9+xF0wSUvzaEhDcsYZ1MntlB/hXVmB4c BfZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hSH/pzqnHJhmvnpNbViIPrlE7JaKhF2bqCNFXMf0qyI=; b=HK17ZgYKB6rmFd4B9KPwqXuu5/Uweeu3lqoxi3ht4ukrKbNnAo96JybsyezJcHgfpX H91elUHbqhYZ2asA/H7yoPGJM5a4HAVCob0w7X6fPS9VbWOYfLyiKJEDmwWRzB5itdbz YgyJ2MhKdorvFGhReq7ul88TrtJz3B6PcMW0u4QoM5kATo/G83cF9WNND2YGfJcedZ/X qHsOXxmFtQ3Iy3YT8IN9p/3ItUqsrYWJ3rGO/7EjCweGpkXr+VMoq7e4735T951cQuuN miF5/VF6KA4GRTfg0EW/DyLyTZpNbmFPm03aD5v5f0uwiJ5lYx2f1Bgv93HBSiCdYv9R r9mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hZolOdpU; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y38-20020a056a00182600b0053652e1c0b6si3460035pfa.12.2022.10.29.13.47.58; Sat, 29 Oct 2022 13:48:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hZolOdpU; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229494AbiJ2Upw (ORCPT + 99 others); Sat, 29 Oct 2022 16:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiJ2Upv (ORCPT ); Sat, 29 Oct 2022 16:45:51 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D41EC25EA5; Sat, 29 Oct 2022 13:45:49 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id q1so7592131pgl.11; Sat, 29 Oct 2022 13:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hSH/pzqnHJhmvnpNbViIPrlE7JaKhF2bqCNFXMf0qyI=; b=hZolOdpUebBYpfjmAF3KEiy7Rax6O1IpX0qOeRey0OC3zuO462/AWCuWH4wS2f5ZcZ NjbVUmRe7OYZbvUlxVpgLS9+6tluA9Vo0r0Un/Mlj3YyU3VX+y07wIiwCHNaGcZriuAU D9XuIMkPKJvYVG+hshpDVMLHmIYVMwNLxmFkQoqoA6PUV+MuoENAFprroXoimjXlHAjp ejGeAedSkx7QPQUM0HLVTCU9HZOuw7zGsvc4bfPQ7sy9GrABqwQY4atxpz5hjmgqAtMy 0Sd6pgSJHVcNoCSJvalzHka3/Z/thV1tCRGppwKjtprVL3t12Df2tzJM4sGv4J/R4mxE afBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hSH/pzqnHJhmvnpNbViIPrlE7JaKhF2bqCNFXMf0qyI=; b=eqzkjMH4hPaqHTJbpbIg+IWTS12cUUi3ZQfxVfhXiTQ1v1DsidDDh8iKweI+XLMHpq a+VEEOU2/dL1qmDgGO6J/sZrIRvPRC04fJZYqjuWkaDoF59OCYwOiFdgmK//2nsiVj7x C9nDl09c3hC1nVufJn9ep7/snwwtpkv0/JfUmYrKqlWuerqVe5kl7xypd0sY6OGHYB2Z sYC/rF0b6iXaXr1/NzuH4BdS0N2shRPnMwLQ4rH9Lk880sr+4lGPcw1oQ7tRmgynx0MJ OnbCnqAlcGVhVT/ncDQP2zDqewvDaKbzmFZ2C7KnenXQc64BCupypIT7xkWdVTrswLLd l3Mw== X-Gm-Message-State: ACrzQf1XdggBAp6Mi34gSHYGWzIvN5acn7jenqApuYuAHXeqJZurgZzm 3abMtk/H3AnBJLudRVUY/bvNTNcghCth5RrB X-Received: by 2002:a63:6986:0:b0:43c:8417:8dac with SMTP id e128-20020a636986000000b0043c84178dacmr5335735pgc.286.1667076349102; Sat, 29 Oct 2022 13:45:49 -0700 (PDT) Received: from uftrace.. ([14.5.161.231]) by smtp.gmail.com with ESMTPSA id q42-20020a17090a17ad00b0021282014066sm1461246pja.9.2022.10.29.13.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 13:45:48 -0700 (PDT) From: Kang Minchul To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kang Minchul Subject: [PATCH] net: bluetooth: Use kzalloc instead of kmalloc/memset Date: Sun, 30 Oct 2022 05:45:41 +0900 Message-Id: <20221029204541.20967-1-tegongkang@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This commit replace kmalloc + memset to kzalloc for better code readability and simplicity. Following messages are related cocci warnings. WARNING: kzalloc should be used for d, instead of kmalloc/memset Signed-off-by: Kang Minchul --- net/bluetooth/hci_conn.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 7a59c4487050..287d313aa312 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -824,11 +824,10 @@ static int hci_le_terminate_big(struct hci_dev *hdev, u8 big, u8 bis) bt_dev_dbg(hdev, "big 0x%2.2x bis 0x%2.2x", big, bis); - d = kmalloc(sizeof(*d), GFP_KERNEL); + d = kzalloc(sizeof(*d), GFP_KERNEL); if (!d) return -ENOMEM; - memset(d, 0, sizeof(*d)); d->big = big; d->bis = bis; @@ -861,11 +860,10 @@ static int hci_le_big_terminate(struct hci_dev *hdev, u8 big, u16 sync_handle) bt_dev_dbg(hdev, "big 0x%2.2x sync_handle 0x%4.4x", big, sync_handle); - d = kmalloc(sizeof(*d), GFP_KERNEL); + d = kzalloc(sizeof(*d), GFP_KERNEL); if (!d) return -ENOMEM; - memset(d, 0, sizeof(*d)); d->big = big; d->sync_handle = sync_handle; -- 2.34.1