lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221130210202.2069213-1-vincent.knecht@mailoo.org>
Date:   Wed, 30 Nov 2022 22:01:59 +0100
From:   Vincent Knecht <vincent.knecht@...loo.org>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Vincent Knecht <vincent.knecht@...loo.org>,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     w.david0@...tonmail.com, stephan@...hold.net,
        phone-devel@...r.kernel.org
Subject: [PATCH RESEND] Input: msg2638 - only read linux,keycodes array if necessary

The linux,keycodes property is optional.
Fix the driver not probing when it's not specified.

Fixes: c18ef50346f2 ("Input: msg2638 - add support for msg2138 key events")
Signed-off-by: Vincent Knecht <vincent.knecht@...loo.org>
---
Resending because of mailing issue,
ie. not appearing on mailing lists.
---
 drivers/input/touchscreen/msg2638.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/msg2638.c b/drivers/input/touchscreen/msg2638.c
index 51b1c0e8a761..4c0816b09d33 100644
--- a/drivers/input/touchscreen/msg2638.c
+++ b/drivers/input/touchscreen/msg2638.c
@@ -412,13 +412,15 @@ static int msg2638_ts_probe(struct i2c_client *client)
 		msg2638->num_keycodes = ARRAY_SIZE(msg2638->keycodes);
 	}
 
-	error = device_property_read_u32_array(dev, "linux,keycodes",
-					       msg2638->keycodes,
-					       msg2638->num_keycodes);
-	if (error) {
-		dev_err(dev, "Unable to read linux,keycodes values: %d\n",
-			error);
-		return error;
+	if (msg2638->num_keycodes > 0) {
+		error = device_property_read_u32_array(dev, "linux,keycodes",
+						       msg2638->keycodes,
+						       msg2638->num_keycodes);
+		if (error) {
+			dev_err(dev, "Unable to read linux,keycodes values: %d\n",
+				error);
+			return error;
+		}
 	}
 
 	error = devm_request_threaded_irq(dev, client->irq,
-- 
2.38.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ