From: Loke Forsberg <loke.forsberg@gmail.com>
To: linux-usb@vger.kernel.org
Cc: gregkh@linuxfoundation.org, khtsai@google.com,
raubcameo@gmail.com, kees@kernel.org,
linux-kernel@vger.kernel.org,
Loke Forsberg <Loke.Forsberg@gmail.com>
Subject: [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj
Date: Mon, 16 Mar 2026 10:25:05 +0100 [thread overview]
Message-ID: <20260316092505.8841-1-Loke.Forsberg@gmail.com> (raw)
Replace kzalloc(sizeof(*ptr)) with kzalloc_obj(), to improve type safety.
Signed-off-by: Loke Forsberg <Loke.Forsberg@gmail.com>
---
Changes in v2:
- Remove GFP_KERNEL flag as kzalloc_obj() defaults to it
drivers/usb/gadget/function/f_ncm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index 14fc7dce6f39..1bec7e99b04f 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1456,7 +1456,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
return -EINVAL;
if (cdev->use_os_string) {
- os_desc_table = kzalloc(sizeof(*os_desc_table), GFP_KERNEL);
+ os_desc_table = kzalloc_obj(os_desc_table);
if (!os_desc_table)
return -ENOMEM;
}
@@ -1753,7 +1753,7 @@ static struct usb_function *ncm_alloc(struct usb_function_instance *fi)
struct f_ncm_opts *opts;
/* allocate and initialize one new instance */
- ncm = kzalloc(sizeof(*ncm), GFP_KERNEL);
+ ncm = kzalloc_obj(ncm);
if (!ncm)
return ERR_PTR(-ENOMEM);
--
2.53.0
next reply other threads:[~2026-03-16 9:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 9:25 Loke Forsberg [this message]
2026-03-17 17:44 ` [PATCH v2] usb: gadget: f_ncm: replace kzalloc with kzalloc_obj kernel test robot
2026-03-17 17:44 ` kernel test robot
2026-03-18 14:10 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260316092505.8841-1-Loke.Forsberg@gmail.com \
--to=loke.forsberg@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kees@kernel.org \
--cc=khtsai@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=raubcameo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox