From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: stephan@gerhold.net, Jeff LaBundy <jeff@labundy.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
dmitry.torokhov@gmail.com, jonathan.albrieux@gmail.com,
krzysztof.kozlowski+dt@linaro.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, robh+dt@kernel.org,
rydberg@bitmath.org
Subject: Re: [PATCH 2/2] Input: add Himax HX852x(ES) touchscreen driver
Date: Sun, 17 Sep 2023 19:58:25 +0200 [thread overview]
Message-ID: <0e2e0e8f-91dd-b458-e39e-b00baf98b4e0@wanadoo.fr> (raw)
In-Reply-To: <ZQcrQIfXYCv5aMK7@nixie71>
Le 17/09/2023 à 18:37, Jeff LaBundy a écrit :
>>> + error = input_register_device(hx->input_dev);
>>> + if (error) {
>>
>> input_mt_destroy_slots() should be called here, or in an error handling path
>> below, or via a devm_add_action_or_reset().
>
> This seems like a memory leak in every touchscreen driver; maybe it is more
> practical to have the input core handle this clean-up.
>
> Other drivers can and do insert other return paths between input_mt_init_slots()
> and input_register_device(), so it seems that we cannot solve this by calling
> input_mt_destroy_slots() from the error path within input_register_device().
>
> Maybe a better option is to update input_mt_init_slots() to use device-managed
> allocation instead?
I think that devm_ is the way to go:
$ git grep input_mt_init_slots | wc -l
82
$ git grep input_mt_destroy_slots | wc -l
6
I'll send a patch for it.
>
>>
>> It should also be called in a .remove function (unless
>> devm_add_action_or_reset is prefered)
>
> I think the remove path is OK, as input_dev_release() handles this for us. In
> case I have misunderstood, please let me know.
Agreed. I missed that.
CJ
prev parent reply other threads:[~2023-09-17 17:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 13:25 [PATCH 0/2] Input: add Himax HX852x(ES) touchscreen driver Stephan Gerhold
2023-09-13 13:25 ` [PATCH 1/2] dt-bindings: input: touchscreen: document Himax HX852x(ES) Stephan Gerhold
2023-09-14 6:22 ` Krzysztof Kozlowski
2023-09-13 13:25 ` [PATCH 2/2] Input: add Himax HX852x(ES) touchscreen driver Stephan Gerhold
2023-09-16 20:47 ` Jeff LaBundy
2023-09-17 17:05 ` Stephan Gerhold
2023-09-27 2:59 ` Jeff LaBundy
2023-09-30 14:27 ` Stephan Gerhold
2023-09-30 15:28 ` Stephan Gerhold
2023-10-22 18:28 ` Jeff LaBundy
2023-09-17 6:03 ` Christophe JAILLET
2023-09-17 16:37 ` Jeff LaBundy
2023-09-17 17:15 ` Stephan Gerhold
2023-09-17 17:58 ` Christophe JAILLET [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=0e2e0e8f-91dd-b458-e39e-b00baf98b4e0@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=jeff@labundy.com \
--cc=jonathan.albrieux@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=rydberg@bitmath.org \
--cc=stephan@gerhold.net \
/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).