Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753270AbbGKHSE (ORCPT ); Sat, 11 Jul 2015 03:18:04 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:35792 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbbGKHSD (ORCPT ); Sat, 11 Jul 2015 03:18:03 -0400 MIME-Version: 1.0 In-Reply-To: <1436447969-24583-2-git-send-email-k.kozlowski.k@gmail.com> References: <1436447969-24583-1-git-send-email-k.kozlowski.k@gmail.com> <1436447969-24583-2-git-send-email-k.kozlowski.k@gmail.com> Date: Sat, 11 Jul 2015 10:01:44 +0800 Message-ID: Subject: Re: [RFT PATCH 2/2] ASoC: zx: spdif: Fix devm_ioremap_resource return value check From: Jun Nie To: Krzysztof Kozlowski Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1613 Lines: 41 2015-07-09 21:19 GMT+08:00 Krzysztof Kozlowski : > 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 > Cc: > Fixes: 6fc3d24d4277 ("ASoC: zx: Add zx296702 SPDIF support") > > --- > > Patch only compile tested. > --- > sound/soc/zte/zx296702-spdif.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/zte/zx296702-spdif.c b/sound/soc/zte/zx296702-spdif.c > index 11a0e46a1156..26265ce4caca 100644 > --- a/sound/soc/zte/zx296702-spdif.c > +++ b/sound/soc/zte/zx296702-spdif.c > @@ -322,9 +322,9 @@ static int zx_spdif_probe(struct platform_device *pdev) > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > zx_spdif->mapbase = res->start; > zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res); > - if (!zx_spdif->reg_base) { > + if (IS_ERR(zx_spdif->reg_base)) { > dev_err(&pdev->dev, "ioremap failed!\n"); > - return -EIO; > + return PTR_ERR(zx_spdif->reg_base); > } > > zx_spdif_dev_init(zx_spdif->reg_base); > -- > 2.1.4 > Reviewed-by: Jun Nie -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/