diff mbox series

Input: - fix incorrect size when reading product ID

Message ID ZsPdmtfC54R7JVxR@google.com (mailing list archive)
State Mainlined
Commit 4e870e6bbec5c41c0d8b253282dca9465fbf5044
Headers show
Series Input: - fix incorrect size when reading product ID | expand

Commit Message

Dmitry Torokhov Aug. 20, 2024, 12:04 a.m. UTC
We need to read a u32 value (4 bytes), not size of a pointer to that
value.

Also, himax_read_mcu() wrapper is an overkill, remove it and use
himax_bus_read() directly.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408200301.Ujpj7Vov-lkp@intel.com/
Fixes: 0944829d491e ("Input: himax_hx83112b - implement MCU register reading") 
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/himax_hx83112b.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

Felix Kaechele Aug. 20, 2024, 12:24 a.m. UTC | #1
Thanks for fixing my rookie mistakes ;-)

Just tested it on my Lenovo ThinkSmart View and it works fine.

Tested-by: Felix Kaechele <felix@kaechele.ca>

Thanks,
Felix
Dmitry Torokhov Aug. 20, 2024, 12:28 a.m. UTC | #2
On Mon, Aug 19, 2024 at 08:24:33PM -0400, Felix Kaechele wrote:
> Thanks for fixing my rookie mistakes ;-)
> 
> Just tested it on my Lenovo ThinkSmart View and it works fine.
> 
> Tested-by: Felix Kaechele <felix@kaechele.ca>

Thanks for the quick test.
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/himax_hx83112b.c b/drivers/input/touchscreen/himax_hx83112b.c
index 9ed3bccde4ac..896a145ddb2b 100644
--- a/drivers/input/touchscreen/himax_hx83112b.c
+++ b/drivers/input/touchscreen/himax_hx83112b.c
@@ -130,17 +130,6 @@  static int himax_bus_read(struct himax_ts_data *ts, u32 address, void *dst,
 	return 0;
 }
 
-static int himax_read_mcu(struct himax_ts_data *ts, u32 address, u32 *dst)
-{
-	int error;
-
-	error = himax_bus_read(ts, address, dst, sizeof(dst));
-	if (error)
-		return error;
-
-	return 0;
-}
-
 static void himax_reset(struct himax_ts_data *ts)
 {
 	gpiod_set_value_cansleep(ts->gpiod_rst, 1);
@@ -160,7 +149,8 @@  static int himax_read_product_id(struct himax_ts_data *ts, u32 *product_id)
 {
 	int error;
 
-	error = himax_read_mcu(ts, HIMAX_REG_ADDR_ICID, product_id);
+	error = himax_bus_read(ts, HIMAX_REG_ADDR_ICID, product_id,
+			       sizeof(*product_id));
 	if (error)
 		return error;