From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Herring Subject: Re: [PATCH] clk: fix error path inside clk_get() Date: Sun, 15 Jul 2012 14:03:12 -0500 Message-ID: <500313F0.3060605@gmail.com> References: <1342375269-6410-1-git-send-email-blogic@openwrt.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1342375269-6410-1-git-send-email-blogic-p3rKhJxN3npAfugRpC6u6w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: John Crispin Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Mike Turquette List-Id: devicetree@vger.kernel.org On 07/15/2012 01:01 PM, John Crispin wrote: > clk_get() calls of_clk_get_by_name() which can return a ERR_PTR. The error path > currently only checks for !NULL. We need to use !IS_ERR_OR_NULL instead. > > This bug was introduced by 766e6a4ec602d0c107553b91b3434fe9c03474f4 > > Signed-off-by: John Crispin > Cc: Rob Herring > Cc: Grant Likely > Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > --- > I am seeing this bug on linux-next from 13.07.2012 Already got a fix for this from Shawn Guo earlier today. > > drivers/clk/clkdev.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c > index 20649b3..7100d5c 100644 > --- a/drivers/clk/clkdev.c > +++ b/drivers/clk/clkdev.c > @@ -157,7 +157,7 @@ struct clk *clk_get(struct device *dev, const char *con_id) > > if (dev) { > clk = of_clk_get_by_name(dev->of_node, con_id); > - if (clk && __clk_get(clk)) > + if (!IS_ERR_OR_NULL(clk) && __clk_get(clk)) IS_ERR() is correct here. Rob > return clk; > } > >