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)
committerSebastian Reichel <sre@kernel.org>
Sat, 21 Jan 2017 02:35:07 +0000 (03:35 +0100)
commita1b94355ea3fde5e13db7ff37c0272fcde4e29b2
tree2bfdd9249f4fb528a7dca06648403d4204568721
parentcb190af290329c281ed2fbaf41ce6e4686b69922
power: supply: bq2415x: check for NULL acpi_id to avoid null pointer dereference

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>
drivers/power/supply/bq2415x_charger.c