linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Tanure <tanure@linux.com>
To: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Lucas Tanure <tanure@linux.com>
Subject: [PATCH 2/2] HID: appleir: Use devm_kzalloc() instead of kzalloc()
Date: Sat, 29 Feb 2020 17:43:34 +0000	[thread overview]
Message-ID: <2ab20fa788a1a6996fd2c469f7a96ec780c9bf77.1582998175.git.tanure@linux.com> (raw)
In-Reply-To: <7c4c591bc1aa9e269cbf764a03e64d32dd6e6e96.1582998175.git.tanure@linux.com>

Signed-off-by: Lucas Tanure <tanure@linux.com>
---
 drivers/hid/hid-appleir.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-appleir.c b/drivers/hid/hid-appleir.c
index aafc285b538f..8deded185725 100644
--- a/drivers/hid/hid-appleir.c
+++ b/drivers/hid/hid-appleir.c
@@ -283,7 +283,7 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)
 	int ret;
 	struct appleir *appleir;
 
-	appleir = kzalloc(sizeof(struct appleir), GFP_KERNEL);
+	appleir = devm_kzalloc(&hid->dev, sizeof(struct appleir), GFP_KERNEL);
 	if (!appleir)
 		return -ENOMEM;
 
@@ -311,7 +311,7 @@ static int appleir_probe(struct hid_device *hid, const struct hid_device_id *id)
 
 	return 0;
 fail:
-	kfree(appleir);
+	devm_kfree(&hid->dev, appleir);
 	return ret;
 }
 
@@ -320,7 +320,6 @@ static void appleir_remove(struct hid_device *hid)
 	struct appleir *appleir = hid_get_drvdata(hid);
 	hid_hw_stop(hid);
 	del_timer_sync(&appleir->key_up_timer);
-	kfree(appleir);
 }
 
 static const struct hid_device_id appleir_devices[] = {
-- 
2.25.1


  reply	other threads:[~2020-02-29 17:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-29 17:43 [PATCH 1/2] HID: appleir: Remove unnecessary goto label Lucas Tanure
2020-02-29 17:43 ` Lucas Tanure [this message]
2020-03-13 16:32 ` Jiri Kosina

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=2ab20fa788a1a6996fd2c469f7a96ec780c9bf77.1582998175.git.tanure@linux.com \
    --to=tanure@linux.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).