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

ASoC: zx: i2s: 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
a18da49f d770e558

+2 -2
+2 -2
sound/soc/zte/zx296702-i2s.c
··· 393 393 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 394 394 zx_i2s->mapbase = res->start; 395 395 zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res); 396 - if (!zx_i2s->reg_base) { 396 + if (IS_ERR(zx_i2s->reg_base)) { 397 397 dev_err(&pdev->dev, "ioremap failed!\n"); 398 - return -EIO; 398 + return PTR_ERR(zx_i2s->reg_base); 399 399 } 400 400 401 401 writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);