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: Nicholas Mc Guire <hofrat@osadl.org> Fixes: 2051f25d ("iio: adc: New driver for AD7280A Lithium Ion Battery Monitoring System2") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Showing
Please register or sign in to comment