Thread (3 messages) flat view 3 messages, 2 authors, 2011-10-19

Re: [PATCH RESEND] input: keyboard: adp5589-keys: Add support for the ADP5585 derivatives

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-10-19 04:26:21

Hi Michael,

On Thu, Oct 13, 2011 at 08:18:46AM +0200, michael.hennerich@analog.com wrote:
 static void __devinit adp5589_report_switch_state(struct adp5589_kpad *kpad)
 {
-	int gpi_stat1 = adp5589_read(kpad->client, ADP5589_GPI_STATUS_A);
-	int gpi_stat2 = adp5589_read(kpad->client, ADP5589_GPI_STATUS_B);
-	int gpi_stat3 = adp5589_read(kpad->client, ADP5589_GPI_STATUS_C);
-	int gpi_stat_tmp, pin_loc;
+	int gpi_stat_tmp, pin_loc, gpi_stat3;
 	int i;
+	int gpi_stat1 = adp5589_read(kpad->client,
+				     kpad->var->reg(ADP5589_GPI_STATUS_A));
+	int gpi_stat2 = adp5589_read(kpad->client,
+				     kpad->var->reg(ADP5589_GPI_STATUS_B));
+	if (!kpad->is_adp5585)
+		gpi_stat3 = adp5589_read(kpad->client, ADP5589_GPI_STATUS_C);
This cause my compiler to complain that gpi_stat3 might be used
uninitialized; I changed it to

	int gpi_stat3 = !kpad->is_adp5585 ?
			adp5589_read(kpad->client, ADP5589_GPI_STATUS_C) : 0;

and applied.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help