Skip to content
Commit 53e8785c authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Jonathan Cameron
Browse files

staging: iio: adc: ad7280a: check for devm_kasprint() failure



devm_kasprintf() may return NULL on failure of internal allocation thus
the assignments to  attr.name  are not safe if not checked. On error
ad7280_attr_init() returns a negative return so -ENOMEM should be
OK here (passed on as return value of the probe function). To make the
error case more readable a temporary  iio_attr  is introduced and the code
refactored.

Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Fixes: 2051f25d ("iio: adc: New driver for AD7280A Lithium Ion Battery Monitoring System2")
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 88884a50
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment