mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Input: goodix_berlin - reject devices without match data
@ 2026-09-25 13:36 Jiale Yao
  2026-09-26  1:05 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-09-25 13:36 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Neil Armstrong, Jens Reidel,
	linux-input, linux-kernel
  Cc: Jiale Yao

A device bound through driver_override need not match an entry in the
driver tables. In that case spi_get_device_match_data() returns NULL,
but goodix_berlin_spi_probe() dereferences the result while calculating
the regmap transfer limits.

Reject devices without match data before using the chip information.

Fixes: 4d395cb071a3 ("Input: goodix_berlin - add support for Berlin-A series")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/input/touchscreen/goodix_berlin_spi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/goodix_berlin_spi.c b/drivers/input/touchscreen/goodix_berlin_spi.c
index 01f850f484c2..db9e151ced65 100644
--- a/drivers/input/touchscreen/goodix_berlin_spi.c
+++ b/drivers/input/touchscreen/goodix_berlin_spi.c
@@ -127,12 +127,16 @@ static const struct input_id goodix_berlin_spi_input_id = {
 
 static int goodix_berlin_spi_probe(struct spi_device *spi)
 {
-	const struct goodix_berlin_ic_data *ic_data = spi_get_device_match_data(spi);
+	const struct goodix_berlin_ic_data *ic_data;
 	struct regmap_config regmap_config;
 	struct regmap *regmap;
 	size_t max_size;
 	int error = 0;
 
+	ic_data = spi_get_device_match_data(spi);
+	if (!ic_data)
+		return -ENODATA;
+
 	spi->mode = SPI_MODE_0;
 	spi->bits_per_word = 8;
 	error = spi_setup(spi);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: goodix_berlin - reject devices without match data
  2026-09-25 13:36 [PATCH] Input: goodix_berlin - reject devices without match data Jiale Yao
@ 2026-09-26  1:05 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2026-09-26  1:05 UTC (permalink / raw)
  To: Jiale Yao
  Cc: Hans de Goede, Neil Armstrong, Jens Reidel, linux-input, linux-kernel

Hi Jiale,

On Fri, Sep 25, 2026 at 09:36:38PM +0800, Jiale Yao wrote:
> A device bound through driver_override need not match an entry in the
> driver tables. In that case spi_get_device_match_data() returns NULL,
> but goodix_berlin_spi_probe() dereferences the result while calculating
> the regmap transfer limits.

We are not planning to address issues caused by incompatible writes to
driver_override. This is a privileged operation.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-26  1:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 13:36 [PATCH] Input: goodix_berlin - reject devices without match data Jiale Yao
2026-09-26  1:05 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®