All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Jiri Kosina <jkosina@suse.cz>, kernel test robot <lkp@intel.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y 2/5] HID: sony: remove duplicate NULL check before calling usb_free_urb()
Date: Mon,  7 Sep 2026 20:39:18 -0400	[thread overview]
Message-ID: <20260908003921.1609143-2-sashal@kernel.org> (raw)
In-Reply-To: <20260908003921.1609143-1-sashal@kernel.org>

From: Jiri Kosina <jkosina@suse.cz>

[ Upstream commit b328dd02e19cb9d3b35de4322f5363516a20ac8c ]

usb_free_urb() does the NULL check itself, so there is no need to duplicate
it prior to calling.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: e1cd4004cde7c9 ("HID: sony: Fix a potential memory leak in sony_probe()")
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Stable-dep-of: 7c65699a3a31 ("HID: sony: clean up device list on probe failure")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-sony.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 130237cd11306..621624c1e41b2 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1981,10 +1981,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		quirks |= SHANWAN_GAMEPAD;
 
 	sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL);
-	if (sc == NULL) {
-		hid_err(hdev, "can't alloc sony descriptor\n");
+	if (!sc)
 		return -ENOMEM;
-	}
 
 	spin_lock_init(&sc->lock);
 
@@ -2045,6 +2043,10 @@ static void sony_remove(struct hid_device *hdev)
 {
 	struct sony_sc *sc = hid_get_drvdata(hdev);
 
+	if (sc->ghl_urb) {
+		usb_free_urb(sc->ghl_urb);
+	}
+
 	hid_hw_close(hdev);
 
 	sony_cancel_work_sync(sc);
-- 
2.53.0


  reply	other threads:[~2026-09-08  0:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 13:28 FAILED: patch "[PATCH] HID: sony: clean up device list on probe failure" failed to apply to 5.10-stable tree gregkh
2026-09-08  0:39 ` [PATCH 5.10.y 1/5] HID: sony: remove DualShock4 support Sasha Levin
2026-09-08  0:39   ` Sasha Levin [this message]
2026-09-08  0:39   ` [PATCH 5.10.y 3/5] HID: sony: remove redundant assignment Sasha Levin
2026-09-08  0:39   ` [PATCH 5.10.y 4/5] HID: sony: use guard() and scoped_guard() Sasha Levin
2026-09-08  0:39   ` [PATCH 5.10.y 5/5] HID: sony: clean up device list on probe failure Sasha Levin

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=20260908003921.1609143-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=jkosina@suse.cz \
    --cc=lkp@intel.com \
    --cc=stable@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.