From patchwork Sun Oct 30 18:17:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kang Minchul X-Patchwork-Id: 13035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1913017wru; Sun, 30 Oct 2022 11:32:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7t9rqxPXsLR3eiy7ofu1IiOfEa0HQENiMBv4kjwxHCDlr3DjbaTxh3D6ZQkG89bNu9HZG6 X-Received: by 2002:a63:2d8:0:b0:46e:9da4:df67 with SMTP id 207-20020a6302d8000000b0046e9da4df67mr9099132pgc.176.1667154750063; Sun, 30 Oct 2022 11:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667154750; cv=none; d=google.com; s=arc-20160816; b=ybCTNloC8LvC4vFaWq6zO3Q0fGoPW36S6zKWtmy8oHMumu7f3HnDLzZJ7Fizj4n9cc Eob1GB9lXSAJTBJVpt6kNoMF028VVu+2d4MhQddpugYmuUlckE9iDWlUlgVbVg1SGIlq O1Gt4+gEzzQxAgCyCIJWHbSI3jWdB/E6dH1R+JmmYNrzQe4p6urgbkMgJ32OQbdcujMx Jdev0RWDrLHM9OB6aAqnnoPB6i9Ueub1FtfGlRQovfFOHxrBpBEXaIWbuw71zArMCsOf bDUW8SHwRddVGyMlD2iIp8/uA7CJ/B49eoDMxrDTnlCiuUOdqExDPTE2otHShPYXqvZo 6U/A== 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=FKiTxkhmW01FsjmqPtf+yJSPZRDfXBpZLYs+QLD1Y3s=; b=WknMdPAqoor3hofMqq1e1Z7ecDsWpAGVc8keiJ3Hc9RIBvnY7ljcmQs2LsFFS2yqBp fAYiKPxTwKVNLgGxsnw8Rxe5y5Lxy+KdxLwHkFusHNTv2X6qTJc4Qxa8NHic1W2uTevB abz0VuXPecMlsoLN1hQFoxY5ktDRCong3bVWdKBgdDlElcL3xqQxJdgqlEwe2dXVvfkX rKGzmXgQ1yJH6ktq3Puds+7fEvew43j30eC04af34oHNMe41/JKrJoq6Bb1kqteJk/fo Rg5KsN4FFWnsSZVNz6NLzSGeetTFIg3BQohhbZUIJHkZSbXRw2LeWg2Ne2+tODWEniGa 5lZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KMjRbyUQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a170902e80900b00184306292a5si6919702plg.229.2022.10.30.11.32.14; Sun, 30 Oct 2022 11:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=KMjRbyUQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S229726AbiJ3SRc (ORCPT + 99 others); Sun, 30 Oct 2022 14:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiJ3SRb (ORCPT ); Sun, 30 Oct 2022 14:17:31 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86371B484; Sun, 30 Oct 2022 11:17:29 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id m6so8951486pfb.0; Sun, 30 Oct 2022 11:17:29 -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=FKiTxkhmW01FsjmqPtf+yJSPZRDfXBpZLYs+QLD1Y3s=; b=KMjRbyUQbK/qMAqOzDmwGd/TIltucuP8unSi2yGMRWwxQnFAFAYdVm7N9hAX0wIRJr I1JCALbf47hg2VJqa0kkG6Rqb683/E22lyNTEwLnjyjw1JmejfNWVLIi4LzTeBsM1bWd 2LxNw5VLs5Vs+fLPjVZyAyhVpJCUi82yRGlmUUoAEKGFBMNq9epPtKcUbjsWpBd5n86i Dd451JC1aV3YS2Nf/O3yiUflkg3NvcRCm/IAR5lT4jH0OVMPvXgc1885NbeUfbdPzfu5 t4egUN2rMDR1EU5nCde0Tg2v48sIZkb9cfMH+qdV1zIXaKTN0h+wWmRwGDVCNQjZbOCv BBig== 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=FKiTxkhmW01FsjmqPtf+yJSPZRDfXBpZLYs+QLD1Y3s=; b=hvJbbax3rMdrAhuy3bOIICQV6jBDM2M2QlFqj3j+wNjBndVra3O6ZaZjjVhzdUYiXD xXaNj+AjExNsjzKQ51emHiLo7Wnb4IKpMvrwJpuboPnbjI70xtmxh8RIA1oK+oGaeghR qOlf6cHKAw5NuQtJm58DJPXxvPsl3flE4SLGrVs1CXXgvjVOKj3Hxg4CxWmSaQ7AePNh /WbNPg5kbhU/ZamkzvfLCGZU0URclGYnmpCXPk3jcEToXmDYbUOYXr+UmTazNZTVfvyq vS0EWUaKzwzAagEvP/oty4BhA1RlEKpHeS+HgsNOgJEATwD+0NYARQ+CF+LAQIlrcnkC xoHA== X-Gm-Message-State: ACrzQf3SofgxWN7pv1fxUg4Epx78sE4Dimc6p6r2nuL+CQqgWnkuentC dHXR4/SBHqIqmXeAqYMjn0s= X-Received: by 2002:a63:8942:0:b0:46e:c02e:2eaf with SMTP id v63-20020a638942000000b0046ec02e2eafmr9271878pgd.394.1667153848974; Sun, 30 Oct 2022 11:17:28 -0700 (PDT) Received: from uftrace.. ([14.5.161.231]) by smtp.gmail.com with ESMTPSA id nk21-20020a17090b195500b0020af2bab83fsm2704076pjb.23.2022.10.30.11.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 11:17:28 -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 v3] Bluetooth: Use kzalloc instead of kmalloc/memset Date: Mon, 31 Oct 2022 03:17:22 +0900 Message-Id: <20221030181722.34788-1-tegongkang@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748060201745625635?= X-GMAIL-MSGID: =?utf-8?q?1748138459303783632?= Replace kmalloc+memset by kzalloc for better readability and simplicity. This addresses the cocci warning below: 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;