diff mbox series

[4/4] scsi: pm80xx: Use bitmap_zalloc() for tags bitmap allocation

Message ID 20211101232825.2350233-5-ipylypiv@google.com (mailing list archive)
State Accepted
Headers show
Series small pm80xx cleanups and fixes | expand

Commit Message

Igor Pylypiv Nov. 1, 2021, 11:28 p.m. UTC
We used to allocate X bytes while we only need X bits.

Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
---
 drivers/scsi/pm8001/pm8001_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jinpu Wang Nov. 2, 2021, 7:08 a.m. UTC | #1
On Tue, Nov 2, 2021 at 12:29 AM Igor Pylypiv <ipylypiv@google.com> wrote:
>
> We used to allocate X bytes while we only need X bits.
>
> Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Thanks
> ---
>  drivers/scsi/pm8001/pm8001_init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
> index 47db7e0beae6..9935cf20b93d 100644
> --- a/drivers/scsi/pm8001/pm8001_init.c
> +++ b/drivers/scsi/pm8001/pm8001_init.c
> @@ -178,7 +178,7 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
>         }
>         PM8001_CHIP_DISP->chip_iounmap(pm8001_ha);
>         flush_workqueue(pm8001_wq);
> -       kfree(pm8001_ha->tags);
> +       bitmap_free(pm8001_ha->tags);
>         kfree(pm8001_ha);
>  }
>
> @@ -1193,7 +1193,7 @@ pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost,
>         can_queue = ccb_count - PM8001_RESERVE_SLOT;
>         shost->can_queue = can_queue;
>
> -       pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL);
> +       pm8001_ha->tags = bitmap_zalloc(ccb_count, GFP_KERNEL);
>         if (!pm8001_ha->tags)
>                 goto err_out;
>
> --
> 2.33.1.1089.g2158813163f-goog
>
diff mbox series

Patch

diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 47db7e0beae6..9935cf20b93d 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -178,7 +178,7 @@  static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
 	}
 	PM8001_CHIP_DISP->chip_iounmap(pm8001_ha);
 	flush_workqueue(pm8001_wq);
-	kfree(pm8001_ha->tags);
+	bitmap_free(pm8001_ha->tags);
 	kfree(pm8001_ha);
 }
 
@@ -1193,7 +1193,7 @@  pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost,
 	can_queue = ccb_count - PM8001_RESERVE_SLOT;
 	shost->can_queue = can_queue;
 
-	pm8001_ha->tags = kzalloc(ccb_count, GFP_KERNEL);
+	pm8001_ha->tags = bitmap_zalloc(ccb_count, GFP_KERNEL);
 	if (!pm8001_ha->tags)
 		goto err_out;