Linux Input/HID development
 help / color / mirror / Atom feed
From: Ismail Tarim <ismailtarim7@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: James Ogletree <jogletre@opensource.cirrus.com>,
	Fred Treven <fred.treven@cirrus.com>,
	Ben Bright <ben.bright@cirrus.com>,
	patches@opensource.cirrus.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] Input: cs40l50 - fix work item leak in stop worker
Date: Sat, 31 Oct 2026 12:54:35 +0300	[thread overview]
Message-ID: <20261031095438.3070451-2-ismailtarim7@gmail.com> (raw)
In-Reply-To: <20261031095438.3070451-1-ismailtarim7@gmail.com>

cs40l50_playback() allocates a work item for every playback request,
and the start and stop workers are responsible for freeing it.
cs40l50_stop_worker() returns early when pm_runtime_resume_and_get()
fails and never frees the item.

Free it on that path too, as cs40l50_start_worker() already does.

Fixes: c38fe1bb5d21 ("Input: cs40l50 - Add support for the CS40L50 haptic driver")
Signed-off-by: Ismail Tarim <ismailtarim7@gmail.com>
---
Build-tested only (W=1, x86_64 defconfig with the CS40L50 drivers as
modules). I do not have CS40L50 hardware, so this was not runtime
tested.

 drivers/input/misc/cs40l50-vibra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/cs40l50-vibra.c b/drivers/input/misc/cs40l50-vibra.c
index 68f0c40ef..cbe69f6c7 100644
--- a/drivers/input/misc/cs40l50-vibra.c
+++ b/drivers/input/misc/cs40l50-vibra.c
@@ -384,12 +384,12 @@ static void cs40l50_stop_worker(struct work_struct *work)
 	struct cs40l50_vibra *vib = work_data->vib;
 
 	if (pm_runtime_resume_and_get(vib->dev) < 0)
-		return;
+		goto err_free;
 
 	vib->dsp.write(vib->dev, vib->regmap, vib->dsp.stop_cmd);
 
 	pm_runtime_put_autosuspend(vib->dev);
-
+err_free:
 	kfree(work_data);
 }
 
-- 
2.56.0


      reply	other threads:[~2026-10-31  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31  9:54 [PATCH 1/2] Input: cs40l50 - fix OWT upload length Ismail Tarim
2026-10-31  9:54 ` Ismail Tarim [this message]

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=20261031095438.3070451-2-ismailtarim7@gmail.com \
    --to=ismailtarim7@gmail.com \
    --cc=ben.bright@cirrus.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=fred.treven@cirrus.com \
    --cc=jogletre@opensource.cirrus.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    /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