* [PATCH] scsi: hpsa: kzalloc + kcalloc to kzalloc_flex
@ 2026-03-20 4:18 Rosen Penev
0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-03-20 4:18 UTC (permalink / raw)
To: linux-scsi
Cc: Don Brace, James E.J. Bottomley, Martin K. Petersen,
open list:HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa),
open list
Simplifies allocation and freeing the struct.
Removed hpda_free_ctlr_info as it's now just a single kfree.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/scsi/hpsa.c | 17 +++--------------
drivers/scsi/hpsa.h | 2 +-
2 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a1b116cd4723..608c45f4f749 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -8621,25 +8621,14 @@ static struct workqueue_struct *hpsa_create_controller_wq(struct ctlr_info *h,
return wq;
}
-static void hpda_free_ctlr_info(struct ctlr_info *h)
-{
- kfree(h->reply_map);
- kfree(h);
-}
-
static struct ctlr_info *hpda_alloc_ctlr_info(void)
{
struct ctlr_info *h;
- h = kzalloc_obj(*h);
+ h = kzalloc_flex(*h, reply_map, nr_cpu_ids, GFP_KERNEL);
if (!h)
return NULL;
- h->reply_map = kcalloc(nr_cpu_ids, sizeof(*h->reply_map), GFP_KERNEL);
- if (!h->reply_map) {
- kfree(h);
- return NULL;
- }
return h;
}
@@ -8909,7 +8898,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
destroy_workqueue(h->monitor_ctlr_wq);
h->monitor_ctlr_wq = NULL;
}
- hpda_free_ctlr_info(h);
+ kfree(h);
return rc;
}
@@ -9093,7 +9082,7 @@ static void hpsa_remove_one(struct pci_dev *pdev)
free_percpu(h->lockup_detected); /* init_one 2 */
h->lockup_detected = NULL; /* init_one 2 */
- hpda_free_ctlr_info(h); /* init_one 1 */
+ kfree(h); /* init_one 1 */
}
static int __maybe_unused hpsa_suspend(
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 99b0750850b2..935c2e1a840d 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -162,7 +162,6 @@ struct bmic_controller_parameters {
#pragma pack()
struct ctlr_info {
- unsigned int *reply_map;
int ctlr;
char devname[8];
char *product_name;
@@ -311,6 +310,7 @@ struct ctlr_info {
u8 reset_in_progress;
struct hpsa_sas_node *sas_host;
spinlock_t reset_lock;
+ unsigned int reply_map[];
};
struct offline_device_entry {
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-20 4:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 4:18 [PATCH] scsi: hpsa: kzalloc + kcalloc to kzalloc_flex Rosen Penev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox