Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: zx: spdif: Fix devm_ioremap_resource return value check

Value returned by devm_ioremap_resource() was checked for non-NULL but
devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
error this could lead to dereference of ERR_PTR.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Reviewed-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
2dfbe9af a18da49f

+2 -2
+2 -2
sound/soc/zte/zx296702-spdif.c
··· 322 322 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 323 323 zx_spdif->mapbase = res->start; 324 324 zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res); 325 - if (!zx_spdif->reg_base) { 325 + if (IS_ERR(zx_spdif->reg_base)) { 326 326 dev_err(&pdev->dev, "ioremap failed!\n"); 327 - return -EIO; 327 + return PTR_ERR(zx_spdif->reg_base); 328 328 } 329 329 330 330 zx_spdif_dev_init(zx_spdif->reg_base);