From: Samyak <samyak.bambole07@gmail.com>
To: linux-staging@lists.linux.dev
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
Samyak Bambole <samyak.bambole07@gmail.com>
Subject: [PATCH v2] staging: vme_user: use kmalloc_obj instead of kmalloc
Date: Sat, 14 Feb 2026 21:43:21 +0530 [thread overview]
Message-ID: <20260214161321.669459-1-samyak.bambole07@gmail.com> (raw)
From: Samyak Bambole <samyak.bambole07@gmail.com>
Replace kmalloc(sizeof(*ptr), GFP_KERNEL) calls with kmalloc_obj(*ptr,
GFP_KERNEL)
This addresses scripts/checkpatch.pl warnings and follows the preffered
allocation pattern.
Signed-off-by: Samyak Bambole <samyak.bambole07@gmail.com>
---
drivers/staging/vme_user/vme.c | 24 ++++++++++++------------
drivers/staging/vme_user/vme_fake.c | 6 +++---
drivers/staging/vme_user/vme_tsi148.c | 14 +++++++-------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c
index 2095de725..8496c722a 100644
--- a/drivers/staging/vme_user/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -287,7 +287,7 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
if (!allocated_image)
goto err_image;
- resource = kmalloc(sizeof(*resource), GFP_KERNEL);
+ resource = kmalloc_obj(*resource, GFP_KERNEL);
if (!resource)
goto err_alloc;
@@ -484,7 +484,7 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
goto err_image;
}
- resource = kmalloc(sizeof(*resource), GFP_KERNEL);
+ resource = kmalloc_obj(*resource, GFP_KERNEL);
if (!resource)
goto err_alloc;
@@ -854,7 +854,7 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
if (!allocated_ctrlr)
goto err_ctrlr;
- resource = kmalloc(sizeof(*resource), GFP_KERNEL);
+ resource = kmalloc_obj(*resource, GFP_KERNEL);
if (!resource)
goto err_alloc;
@@ -894,7 +894,7 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
return NULL;
}
- dma_list = kmalloc(sizeof(*dma_list), GFP_KERNEL);
+ dma_list = kmalloc_obj(*dma_list, GFP_KERNEL);
if (!dma_list)
return NULL;
@@ -924,11 +924,11 @@ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type)
struct vme_dma_attr *attributes;
struct vme_dma_pattern *pattern_attr;
- attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
+ attributes = kmalloc_obj(*attributes, GFP_KERNEL);
if (!attributes)
goto err_attr;
- pattern_attr = kmalloc(sizeof(*pattern_attr), GFP_KERNEL);
+ pattern_attr = kmalloc_obj(*pattern_attr, GFP_KERNEL);
if (!pattern_attr)
goto err_pat;
@@ -964,11 +964,11 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address)
/* XXX Run some sanity checks here */
- attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
+ attributes = kmalloc_obj(*attributes, GFP_KERNEL);
if (!attributes)
goto err_attr;
- pci_attr = kmalloc(sizeof(*pci_attr), GFP_KERNEL);
+ pci_attr = kmalloc_obj(*pci_attr, GFP_KERNEL);
if (!pci_attr)
goto err_pci;
@@ -1005,11 +1005,11 @@ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address,
struct vme_dma_attr *attributes;
struct vme_dma_vme *vme_attr;
- attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
+ attributes = kmalloc_obj(*attributes, GFP_KERNEL);
if (!attributes)
goto err_attr;
- vme_attr = kmalloc(sizeof(*vme_attr), GFP_KERNEL);
+ vme_attr = kmalloc_obj(*vme_attr, GFP_KERNEL);
if (!vme_attr)
goto err_vme;
@@ -1233,7 +1233,7 @@ struct vme_error_handler *vme_register_error_handler(struct vme_bridge *bridge,
{
struct vme_error_handler *handler;
- handler = kmalloc(sizeof(*handler), GFP_ATOMIC);
+ handler = kmalloc_obj(*handler, GFP_ATOMIC);
if (!handler)
return NULL;
@@ -1458,7 +1458,7 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
if (!allocated_lm)
goto err_lm;
- resource = kmalloc(sizeof(*resource), GFP_KERNEL);
+ resource = kmalloc_obj(*resource, GFP_KERNEL);
if (!resource)
goto err_alloc;
diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
index 731fbba17..0fc5fe7f8 100644
--- a/drivers/staging/vme_user/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -1102,7 +1102,7 @@ static int __init fake_init(void)
/* Add master windows to list */
INIT_LIST_HEAD(&fake_bridge->master_resources);
for (i = 0; i < FAKE_MAX_MASTER; i++) {
- master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
+ master_image = kmalloc_obj(*master_image, GFP_KERNEL);
if (!master_image) {
retval = -ENOMEM;
goto err_master;
@@ -1128,7 +1128,7 @@ static int __init fake_init(void)
/* Add slave windows to list */
INIT_LIST_HEAD(&fake_bridge->slave_resources);
for (i = 0; i < FAKE_MAX_SLAVE; i++) {
- slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
+ slave_image = kmalloc_obj(*slave_image, GFP_KERNEL);
if (!slave_image) {
retval = -ENOMEM;
goto err_slave;
@@ -1150,7 +1150,7 @@ static int __init fake_init(void)
/* Add location monitor to list */
INIT_LIST_HEAD(&fake_bridge->lm_resources);
- lm = kmalloc(sizeof(*lm), GFP_KERNEL);
+ lm = kmalloc_obj(*lm, GFP_KERNEL);
if (!lm) {
retval = -ENOMEM;
goto err_lm;
diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
index 733594dde..62b16be15 100644
--- a/drivers/staging/vme_user/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -1611,7 +1611,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *s
tsi148_bridge = list->parent->parent;
/* Descriptor must be aligned on 64-bit boundaries */
- entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kmalloc_obj(*entry, GFP_KERNEL);
if (!entry) {
retval = -ENOMEM;
goto err_mem;
@@ -2333,8 +2333,8 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
master_num--;
tsi148_device->flush_image =
- kmalloc(sizeof(*tsi148_device->flush_image),
- GFP_KERNEL);
+ kmalloc_obj(*tsi148_device->flush_image,
+ GFP_KERNEL);
if (!tsi148_device->flush_image) {
retval = -ENOMEM;
goto err_master;
@@ -2350,7 +2350,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Add master windows to list */
for (i = 0; i < master_num; i++) {
- master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
+ master_image = kmalloc_obj(*master_image, GFP_KERNEL);
if (!master_image) {
retval = -ENOMEM;
goto err_master;
@@ -2376,7 +2376,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Add slave windows to list */
for (i = 0; i < TSI148_MAX_SLAVE; i++) {
- slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
+ slave_image = kmalloc_obj(*slave_image, GFP_KERNEL);
if (!slave_image) {
retval = -ENOMEM;
goto err_slave;
@@ -2397,7 +2397,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Add dma engines to list */
for (i = 0; i < TSI148_MAX_DMA; i++) {
- dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
+ dma_ctrlr = kmalloc_obj(*dma_ctrlr, GFP_KERNEL);
if (!dma_ctrlr) {
retval = -ENOMEM;
goto err_dma;
@@ -2417,7 +2417,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
/* Add location monitor to list */
- lm = kmalloc(sizeof(*lm), GFP_KERNEL);
+ lm = kmalloc_obj(*lm, GFP_KERNEL);
if (!lm) {
retval = -ENOMEM;
goto err_lm;
--
2.53.0
next reply other threads:[~2026-02-14 16:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 16:13 Samyak [this message]
2026-02-14 16:27 ` Greg KH
2026-02-14 16:28 ` 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=20260214161321.669459-1-samyak.bambole07@gmail.com \
--to=samyak.bambole07@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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
all inboxes | Powered by JetHome®