From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>,
Janusz Krzysztofik <jmkrzyszt@gmail.com>,
Tony Lindgren <tony@atomide.com>,
soc@kernel.org, linux-omap@vger.kernel.org,
linux-input@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH] Input: ads7846 - Fix usage of match data
Date: Tue, 6 Jun 2023 12:15:28 -0700 [thread overview]
Message-ID: <ZH+F0LtkqPoLg4mm@google.com> (raw)
In-Reply-To: <20230606191304.3804174-1-linus.walleij@linaro.org>
On Tue, Jun 06, 2023 at 09:13:04PM +0200, Linus Walleij wrote:
> device_get_match_data() returns the match data directly, fix
> this up and fix the probe crash.
>
> Fixes: 767d83361aaa ("Input: ads7846 - Convert to use software nodes")
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> This patch needs to be applied to the SoC tree where the
> offending patch is residing.
> ---
> drivers/input/touchscreen/ads7846.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index 40eb27f1b23f..fe6fe8acd8a6 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -1117,20 +1117,13 @@ MODULE_DEVICE_TABLE(of, ads7846_dt_ids);
> static const struct ads7846_platform_data *ads7846_get_props(struct device *dev)
> {
> struct ads7846_platform_data *pdata;
> - const struct platform_device_id *pdev_id;
> u32 value;
>
> - pdev_id = device_get_match_data(dev);
> - if (!pdev_id) {
> - dev_err(dev, "Unknown device model\n");
> - return ERR_PTR(-EINVAL);
> - }
> -
> pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> if (!pdata)
> return ERR_PTR(-ENOMEM);
>
> - pdata->model = (unsigned long)pdev_id->driver_data;
> + pdata->model = (u32)device_get_match_data(dev);
>
> device_property_read_u16(dev, "ti,vref-delay-usecs",
> &pdata->vref_delay_usecs);
> --
> 2.34.1
>
--
Dmitry
next prev parent reply other threads:[~2023-06-06 19:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 19:13 [PATCH] Input: ads7846 - Fix usage of match data Linus Walleij
2023-06-06 19:15 ` Dmitry Torokhov [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-06-06 21:34 Guenter Roeck
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=ZH+F0LtkqPoLg4mm@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=aaro.koskinen@iki.fi \
--cc=jmkrzyszt@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=soc@kernel.org \
--cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).