scsi: hpsa: kzalloc + kcalloc to kzalloc_flex
Subsystems (2)
PATCH 1/1 scsi: hpsa: kzalloc + kcalloc to kzalloc_flex
Simplifies allocation and freeing the struct.
Removed hpda_free_ctlr_info as it's now just a single kfree.
Signed-off-by Rosen Penev <[email protected]>
--- drivers/scsi/hpsa.c | 17 +++-------------- drivers/scsi/hpsa.h | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-)
drivers/scsi/hpsa.c +3 -14
@@ -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(
drivers/scsi/hpsa.h +1 -1
@@ -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 {
Signature · 1 line
2.53.0