Skip to content

Commit 8f7913c

Browse files
Linus Walleijarndb
authored andcommitted
Input: ads7846 - Fix usage of match data
device_get_match_data() returns the match data directly, fix this up and fix the probe crash. Fixes: 767d833 ("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> Link: https://lore.kernel.org/r/20230606191304.3804174-1-linus.walleij@linaro.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 0b47a62 commit 8f7913c

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

drivers/input/touchscreen/ads7846.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,20 +1117,13 @@ MODULE_DEVICE_TABLE(of, ads7846_dt_ids);
11171117
static const struct ads7846_platform_data *ads7846_get_props(struct device *dev)
11181118
{
11191119
struct ads7846_platform_data *pdata;
1120-
const struct platform_device_id *pdev_id;
11211120
u32 value;
11221121

1123-
pdev_id = device_get_match_data(dev);
1124-
if (!pdev_id) {
1125-
dev_err(dev, "Unknown device model\n");
1126-
return ERR_PTR(-EINVAL);
1127-
}
1128-
11291122
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
11301123
if (!pdata)
11311124
return ERR_PTR(-ENOMEM);
11321125

1133-
pdata->model = (unsigned long)pdev_id->driver_data;
1126+
pdata->model = (u32)device_get_match_data(dev);
11341127

11351128
device_property_read_u16(dev, "ti,vref-delay-usecs",
11361129
&pdata->vref_delay_usecs);

0 commit comments

Comments
 (0)