Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a18da49f authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown
Browse files

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: default avatarKrzysztof Kozlowski <k.kozlowski.k@gmail.com>
Reviewed-by: default avatarJun Nie <jun.nie@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d770e558
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -393,9 +393,9 @@ static int zx_i2s_probe(struct platform_device *pdev)
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	zx_i2s->mapbase = res->start;
	zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res);
	if (!zx_i2s->reg_base) {
	if (IS_ERR(zx_i2s->reg_base)) {
		dev_err(&pdev->dev, "ioremap failed!\n");
		return -EIO;
		return PTR_ERR(zx_i2s->reg_base);
	}

	writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);