diff mbox

32-rc1 aka 32-rc2: warning at manage.c:361 (set_irq_wake), matrix-keypad related?

Message ID 20091006050649.GH27881@core.coreip.homeip.net (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Torokhov Oct. 6, 2009, 5:06 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 91cfe51..488171c 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -218,14 +218,29 @@  static int matrix_keypad_suspend(struct platform_device *pdev, pm_message_t stat
 	struct matrix_keypad *keypad = platform_get_drvdata(pdev);
 	const struct matrix_keypad_platform_data *pdata = keypad->pdata;
 	int i;
+	int err;
 
 	matrix_keypad_stop(keypad->input_dev);
 
-	if (device_may_wakeup(&pdev->dev))
-		for (i = 0; i < pdata->num_row_gpios; i++)
-			enable_irq_wake(gpio_to_irq(pdata->row_gpios[i]));
+	if (device_may_wakeup(&pdev->dev)) {
+		for (i = 0; i < pdata->num_row_gpios; i++) {
+			err = enable_irq_wake(gpio_to_irq(pdata->row_gpios[i]));
+			if (err) {
+				dev_err(&pdev->dev,
+					"Failed to setup GPIO %d as "
+					"wakeup source, err: %d\n",
+					pdata->row_gpios[i], err);
+				goto err_out;
+			}
+		}
+	}
 
 	return 0;
+
+ err_out:
+	while (--i >= 0)
+		disable_irq_wake(gpio_to_irq(pdata->row_gpios[i]));
+	return err;
 }
 
 static int matrix_keypad_resume(struct platform_device *pdev)