diff mbox series

[-next] soc: loongson2_pm: fix wrong pointer check in loongson2_power_button_init()

Message ID 20230824091016.1070869-1-yangyingliang@huawei.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [-next] soc: loongson2_pm: fix wrong pointer check in loongson2_power_button_init() | expand

Commit Message

Yang Yingliang Aug. 24, 2023, 9:10 a.m. UTC
It should check 'button' after calling input_allocate_device().

Fixes: 67694c076bd7 ("soc: loongson2_pm: add power management support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/soc/loongson/loongson2_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/soc/loongson/loongson2_pm.c b/drivers/soc/loongson/loongson2_pm.c
index 796add6e8b63..6be7ad4c2572 100644
--- a/drivers/soc/loongson/loongson2_pm.c
+++ b/drivers/soc/loongson/loongson2_pm.c
@@ -99,7 +99,7 @@  static int loongson2_power_button_init(struct device *dev, int irq)
 	struct input_dev *button;
 
 	button = input_allocate_device();
-	if (!dev)
+	if (!button)
 		return -ENOMEM;
 
 	button->name = "Power Button";