[PATCH 14/15] Input: synaptics-rmi4 - ensure we have IRQs before reading status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cc: Christopher Heiny <cheiny@xxxxxxxxxxxxx>
Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Signed-off-by: Courtney Cavin <courtney.cavin@xxxxxxxxxxxxxx>
---
 drivers/input/rmi4/rmi_f01.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index 22b57f2..06fc5bc 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -318,13 +318,15 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 	ctrl_base_addr += sizeof(u8);
 
 	data->interrupt_enable_addr = ctrl_base_addr;
-	error = rmi_read_block(rmi_dev, ctrl_base_addr,
-				data->device_control.interrupt_enable,
-				sizeof(u8) * (data->num_of_irq_regs));
-	if (error < 0) {
-		dev_err(&fn->dev,
-			"Failed to read F01 control interrupt enable register.\n");
-		goto error_exit;
+	if (data->num_of_irq_regs > 0) {
+		error = rmi_read_block(rmi_dev, ctrl_base_addr,
+					data->device_control.interrupt_enable,
+					sizeof(u8) * (data->num_of_irq_regs));
+		if (error < 0) {
+			dev_err(&fn->dev,
+				"Failed to read F01 control interrupt enable register.\n");
+			goto error_exit;
+		}
 	}
 
 	ctrl_base_addr += data->num_of_irq_regs;
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux