platform/x86: huawei-wmi: check the return value of device_create_file()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Thu, 3 Mar 2022 02:24:21 +0000 (18:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:38 +0000 (14:23 +0200)
commitee773b7018d61e08a09929ad2926f20ca89d513f
treefa5b2a7395a4c1c9addcf0ef7c596f3a459bdf9e
parentfdee6b347cb82a41afde2cb74ca007d829a64b60
platform/x86: huawei-wmi: check the return value of device_create_file()

[ Upstream commit c91a5b1c221a58d008485cf7d02ccce73108b119 ]

The function device_create_file() in huawei_wmi_battery_add() can fail,
so its return value should be checked.

Fixes: 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220303022421.313-1-baijiaju1990@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/x86/huawei-wmi.c