From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751279AbcCFDBL (ORCPT ); Sat, 5 Mar 2016 22:01:11 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:33795 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbcCFDBK (ORCPT ); Sat, 5 Mar 2016 22:01:10 -0500 Date: Sun, 6 Mar 2016 10:01:00 +0700 From: Lee Jones To: Vladimir Zapolskiy Cc: Jassi Brar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mailbox: sti: fix check of error code returned by devm_ioremap_resource() Message-ID: <20160306030100.GA3326@x1> References: <1457227287-3039-1-git-send-email-vz@mleia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1457227287-3039-1-git-send-email-vz@mleia.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 06 Mar 2016, Vladimir Zapolskiy wrote: > The change fixes potential oops while accessing iomem on invalid > address, if devm_ioremap_resource() fails due to some reason. > > The devm_ioremap_resource() function returns ERR_PTR() and never > returns NULL, which makes useless a following check for NULL. > > Signed-off-by: Vladimir Zapolskiy > Fixes: 9ef4546cbd7e ("mailbox: Add support for ST's Mailbox IP") > --- > drivers/mailbox/mailbox-sti.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Acked-by: Lee Jones > diff --git a/drivers/mailbox/mailbox-sti.c b/drivers/mailbox/mailbox-sti.c > index 2394cfe..a334db5 100644 > --- a/drivers/mailbox/mailbox-sti.c > +++ b/drivers/mailbox/mailbox-sti.c > @@ -430,8 +430,8 @@ static int sti_mbox_probe(struct platform_device *pdev) > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > mdev->base = devm_ioremap_resource(&pdev->dev, res); > - if (!mdev->base) > - return -ENOMEM; > + if (IS_ERR(mdev->base)) > + return PTR_ERR(mdev->base); > > ret = of_property_read_string(np, "mbox-name", &mdev->name); > if (ret) -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog