diff mbox series

soc: loongson2_pm: fix wrong pointer check in loongson2_power_button_init()

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

Commit Message

Yang Yingliang Nov. 29, 2023, 8:27 a.m. UTC
From: Yang Yingliang <yangyingliang@huawei.com>

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 b8e5e1e3528a..76181330696b 100644
--- a/drivers/soc/loongson/loongson2_pm.c
+++ b/drivers/soc/loongson/loongson2_pm.c
@@ -100,7 +100,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";