power: supply: bq2415x: check for NULL acpi_id to avoid null pointer dereference
authorColin Ian King <colin.king@canonical.com>
Fri, 20 Jan 2017 13:25:06 +0000 (13:25 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Apr 2018 09:31:56 +0000 (11:31 +0200)
commitf9437fa5d27bd475017107a59a246c7eb4045b57
tree00cfbd861ea44b81a0d5e2a0fbaa8cd46994e724
parent98b62bd6823dc7da57a940b84c5e16fd459dc50e
power: supply: bq2415x: check for NULL acpi_id to avoid null pointer dereference

commit a1b94355ea3fde5e13db7ff37c0272fcde4e29b2 upstream.

acpi_match_device can potentially return NULL, so it is prudent to
check if acpi_id is null before it is dereferenced.  Add a check
and an error message to indicate the failure.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/power/supply/bq2415x_charger.c