Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755164AbcCULyV (ORCPT ); Mon, 21 Mar 2016 07:54:21 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38312 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754752AbcCULyH (ORCPT ); Mon, 21 Mar 2016 07:54:07 -0400 Date: Mon, 21 Mar 2016 11:54:03 +0000 From: Lee Jones To: Vladimir Zapolskiy Cc: Bjorn Andersson , Ohad Ben-Cohen , Ludovic Barre , linux-kernel@vger.kernel.org Subject: Re: [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value Message-ID: <20160321115403.GB4140@x1> References: <1458394270-21938-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: <1458394270-21938-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 Content-Length: 1212 Lines: 35 On Sat, 19 Mar 2016, Vladimir Zapolskiy wrote: > syscon_regmap_lookup_by_phandle() returns either a valid pointer to > struct regmap or ERR_PTR() error value, check for NULL is invalid and > on error path may lead to oops, the change corrects the check. > > Signed-off-by: Vladimir Zapolskiy > --- > drivers/remoteproc/st_remoteproc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Acked-by: Lee Jones > diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c > index 6bb04d4..6f056ca 100644 > --- a/drivers/remoteproc/st_remoteproc.c > +++ b/drivers/remoteproc/st_remoteproc.c > @@ -189,9 +189,9 @@ static int st_rproc_parse_dt(struct platform_device *pdev) > } > > ddata->boot_base = syscon_regmap_lookup_by_phandle(np, "st,syscfg"); > - if (!ddata->boot_base) { > + if (IS_ERR(ddata->boot_base)) { > dev_err(dev, "Boot base not found\n"); > - return -EINVAL; > + return PTR_ERR(ddata->boot_base); > } > > err = of_property_read_u32_index(np, "st,syscfg", 1, -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog