]> www.infradead.org Git - users/dwmw2/linux.git/commit
iio: adc: meson-saradc: check for devm_kasprintf failure
authorNicholas Mc Guire <hofrat@osadl.org>
Thu, 22 Nov 2018 07:46:43 +0000 (08:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 19:02:10 +0000 (20:02 +0100)
commitdcf38182017d8793342e4aaee6df24c29777b26e
treed8255cf01affa29785a9e5b7bb960fd022ed017e
parenteaa9cde28e3b4cb8e7476f49b052092b68bfbe8b
iio: adc: meson-saradc: check for devm_kasprintf failure

[ Upstream commit aad172b017617994343e36d8659c69e14cd694fd ]

devm_kasprintf() may return NULL on failure of internal allocation thus
the assignments to  init.name  are not safe if not checked. On error
meson_sar_adc_clk_init() returns negative values so -ENOMEM in the
(unlikely) failure case of devm_kasprintf() should be fine here.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs")
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/adc/meson_saradc.c