From patchwork Sat Oct 29 20:45:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kang Minchul X-Patchwork-Id: 12773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1504595wru; Sat, 29 Oct 2022 14:00:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ul3a2eGNisXq0rA69aRteoLgHp9NOKoBX6Edu9MdPufsiHuxZylRWqxN+9jUvnOy9n7io X-Received: by 2002:a17:906:ee8e:b0:730:4a24:f311 with SMTP id wt14-20020a170906ee8e00b007304a24f311mr5526389ejb.420.1667077259734; Sat, 29 Oct 2022 14:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667077259; cv=none; d=google.com; s=arc-20160816; b=QU/MQJQ4Ez8AHc41nSlt3SWeiZmYhrqYVxAgwzuiNt9J9Lbg/k7sFiY+RH20W5ibfb qksO8CEXpWGsLDlxponTAwwQbY+8uaYFy+XaFEnGJBoYkQ8hiyX80RfWwiNXl/enJ0BN 64mOj3tBawGbGsaOlvHIm7qwhSIAaLfS7MplCTHfa9sRz7CUX41WZtEZOux69SNAwiC4 oQTqHS78RboSfpbKYTpqiKGxmvV5hfb8j+a/mzYSFp4tW3L0OQIOGyQQ9D2IYxubjLBM oAb91mW2+IvCZT8HqlIAgMh9rFk6jkQqTKUVySCdpiZX7ynIidpDIYzkGZ0iVuldYKyt SJjw== 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=ja+gy0VIHhJB9Yqf3akLnTo0VxGcVBE335xq6RDEFMhqe0g9XmkO1euOBipFmTuyD0 wfy+gK+xfb5dTIzbATdSz1RG2BCHQovP4sTBbXR5xUrLEWHBNL4CK8OBohTT70iGrGCV +o3yOICuKIrMIQ+takYU1lDR/ddjh1sqGx0mMzlgtqr9XTEiE5dtBNwnweyqWe3cDBuX Wj0Xe8c1alKTRY/JT2wDw6IzrOTut5KXKkJM9GtUDd6fHH8q6ODUsqO6p8gsWdhKpMyz Ij3KGGXmXUvG64jwPwevGFupXIZXfJ+kEFMRgM0qaUfxjPmuM2VrstfzRn3lzgGW/GAr anXg== 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-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 tz14-20020a170907c78e00b007a9d456583bsi2349707ejc.62.2022.10.29.14.00.35; Sat, 29 Oct 2022 14:00:59 -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=hZolOdpU; 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 S229476AbiJ2Upx (ORCPT + 99 others); Sat, 29 Oct 2022 16:45:53 -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 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?1748057204608325593?= X-GMAIL-MSGID: =?utf-8?q?1748057204608325593?= 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;