All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Lamparter <chunkeey@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Kalle Valo <kvalo@kernel.org>
Subject: [PATCH v1 4/5] carl9170: replace bitmap_zalloc with devm_bitmap_zalloc
Date: Wed,  2 Mar 2022 20:51:37 +0100	[thread overview]
Message-ID: <0a79221aa5477501c3def032e95ef8018973a514.1646250537.git.chunkeey@gmail.com> (raw)
In-Reply-To: <f81a6ff3b02116c6a448c42eecb546ea5d46c108.1646250537.git.chunkeey@gmail.com>

the mem_bitmap is kept around for the lifetime of the
driver device. This is a perfect candidate for devm.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
 drivers/net/wireless/ath/carl9170/main.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index e833052e9056..fae927ca4863 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1943,11 +1943,7 @@ int carl9170_register(struct ar9170 *ar)
 	struct ath_regulatory *regulatory = &ar->common.regulatory;
 	int err = 0, i;
 
-	if (WARN_ON(ar->mem_bitmap))
-		return -EINVAL;
-
-	ar->mem_bitmap = bitmap_zalloc(ar->fw.mem_blocks, GFP_KERNEL);
-
+	ar->mem_bitmap = devm_bitmap_zalloc(&ar->udev->dev, ar->fw.mem_blocks, GFP_KERNEL);
 	if (!ar->mem_bitmap)
 		return -ENOMEM;
 
@@ -2050,9 +2046,6 @@ void carl9170_free(struct ar9170 *ar)
 	kfree_skb(ar->rx_failover);
 	ar->rx_failover = NULL;
 
-	bitmap_free(ar->mem_bitmap);
-	ar->mem_bitmap = NULL;
-
 	kfree(ar->survey);
 	ar->survey = NULL;
 
-- 
2.35.1


  reply	other threads:[~2022-03-02 19:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 19:51 [PATCH v1 1/5] carl9170: replace GFP_ATOMIC in ampdu_action, it can sleep Christian Lamparter
2022-03-02 19:51 ` [PATCH v1 2/5] carl9170: devres-ing hwrng_register usage Christian Lamparter
2022-03-02 19:51   ` [PATCH v1 3/5] carl9170: devres-ing input_allocate_device Christian Lamparter
2022-03-02 19:51     ` Christian Lamparter [this message]
2022-03-02 19:51       ` [PATCH v1 5/5] carl9170: devres ar->survey_info Christian Lamparter
2022-03-10 15:55 ` [PATCH v1 1/5] carl9170: replace GFP_ATOMIC in ampdu_action, it can sleep Kalle Valo

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=0a79221aa5477501c3def032e95ef8018973a514.1646250537.git.chunkeey@gmail.com \
    --to=chunkeey@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.