Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp67015imm; Wed, 25 Jul 2018 22:46:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf46SOBPulpYcQR5eLvDcmIOi4b2sJPzFnpFsiQ6MFhNY2cE4xTGNGhBn6s4XoAzTwHB623 X-Received: by 2002:a62:d24a:: with SMTP id c71-v6mr662019pfg.242.1532584009950; Wed, 25 Jul 2018 22:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532584009; cv=none; d=google.com; s=arc-20160816; b=Ngj6J2tKhglg/qcCGfEAPFLH8aNdRokGUZjTa7ANmMZfTnSRWU9lO1qvTcNlQDSslX /Ii6Obby9jUtI6+ZsMmZwQD8KsLpVflJXcn+6d1md9cH7r0TGAHoR7nnOFyEwGdFBmK3 xmOjjGUnvwhfQPzY35SwCemZCvtsUIeCn4rTvYzNFMyfFV/stQzMJJCqAg7ZhXaiIjUM CQrPIbaOra+aW50LSCjbJRv9d0vSOnEQw8HOKktgl/n8uueQHFdl92BvNeSj8ITixVXx fyB4JoVB1KuK+f1Od64f3FjD9hTjXrLKr2D6lNw3XXAJzyzg5y58FosZOkWfaO1v/9vt KK/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=/x6GkeZfPbcH9qQzPK/O8L+6p+2I3b3Ncmg7G3whoVM=; b=sMcE38ayUSgpoF0iKsuCp9MC76PwzrVwGyJ7OdALU8JlKvNKQc9GNkjmUIRk95kY4o V+HHvBQC4sUtWyUoWzXZmBRoqQGy+ioQC8uvVuk3j6bzLgoXfA2pVob7LmtTYHPH/MOi Gf/kDFUHo/TbMWNWxnUuirkm77yU2/1mKAm8O3vY4YUbvqPGnOZvwUXDjZON9dL9xZVj 3ez0wnXzpqDtksuuPTSOxoi2lBqOZR45nN3I9CLkl5D3hsllUo4vSPQ9kKanH0UlCeCg k9eDsrWTo7DkWOApt45kIznZHp2vRL/U4r0zUOcoL11OzHnyWEWhQkS3vqavRRcK26Cj 73fQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si578925pfu.79.2018.07.25.22.46.33; Wed, 25 Jul 2018 22:46:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728951AbeGZHAa (ORCPT + 99 others); Thu, 26 Jul 2018 03:00:30 -0400 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:51531 "EHLO mail.osadl.at" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1728146AbeGZHAa (ORCPT ); Thu, 26 Jul 2018 03:00:30 -0400 Received: by mail.osadl.at (Postfix, from userid 1001) id 8C84D5C0A99; Thu, 26 Jul 2018 05:43:42 +0000 (UTC) Date: Thu, 26 Jul 2018 05:43:42 +0000 From: Nicholas Mc Guire To: Stephen Boyd Cc: Michael Turquette , Nicholas Mc Guire , Kees Cook , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] drivers: clk: st: warn on iomap failure Message-ID: <20180726054342.GA22040@osadl.at> References: <1531649904-6072-1-git-send-email-hofrat@osadl.org> <153255129875.48062.4075642035553635128@swboyd.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <153255129875.48062.4075642035553635128@swboyd.mtv.corp.google.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 25, 2018 at 01:41:38PM -0700, Stephen Boyd wrote: > Quoting Nicholas Mc Guire (2018-07-15 03:18:23) > > While the return value of clkgen_get_register_base() is being checked > > at the call site, there is no indication of failure cause thus making > > diagnosis of the issues hard. The WARN_ON() allows to determine the > > cause of failure. > > > > Signed-off-by: Nicholas Mc Guire > > --- > > > > Problem found by an experimental coccinelle script > > > > Patch was compile tested with: multi_v7_defconfig (implies > > CONFIG_ARCH_STI=y) > > > > Patch is against 4.18-rc4 (localversion-next is next-20180713) > > > > drivers/clk/st/clkgen-pll.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c > > index cbb5184..aeb30ab 100644 > > --- a/drivers/clk/st/clkgen-pll.c > > +++ b/drivers/clk/st/clkgen-pll.c > > @@ -647,6 +647,7 @@ static void __iomem * __init clkgen_get_register_base( > > return NULL; > > > > reg = of_iomap(pnode, 0); > > + WARN_ON(!reg); > > > > of_node_put(pnode); > > return reg; > > Shouldn't the caller blow up on NULL pointer access? This patch doesn't > seem useful, sorry. > if you look at the call chain then there is a check for !NULL along the way - but never any information - no pr_*/printk or the like so ultimately you would get a failure but not know where that failure came from - the intent of the WARN_ON() is to allow you to locate the trigger event. Blowing up with a BUG_ON() is not necessary as the call chain does check for !NULL along the way. thx! hofrat