All of lore.kernel.org
 help / color / mirror / Atom feed
From: Murali Karicheri <m-karicheri2@ti.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Christopher Li <sparse@chrisli.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: How to fix CHECK warning: testing a 'safe expression' ?
Date: Wed, 17 Dec 2014 17:35:21 -0500	[thread overview]
Message-ID: <54920529.4080007@ti.com> (raw)
In-Reply-To: <CAErSpo4hwMPOYBDZTu_fgKaUDYZ4h+jVpz5EigpErOgo6xO8mQ@mail.gmail.com>

On 12/17/2014 01:49 PM, Bjorn Helgaas wrote:
> [+cc Christopher, linux-kernel (this doesn't sound like a PCI-specific
> question)]
>
> On Wed, Dec 17, 2014 at 9:18 AM, Murali Karicheri<m-karicheri2@ti.com>  wrote:
>> I am trying to address CHECK warnings in my driver and wondering how to
>> resolve 'warning: testing a 'safe expression' which appears when using
>> IS_ERR_OR_NULL(foo)
>>
>> where foo is defined as
>>
>> struct foo_type *foo;
>>
>> The foo get assigned only NULL or ERR_PTR(error code). So I believe the
>> usage is correct. But then how do I make the CHECK happy of its usage?
>>
>> I have tried a grep to check on the current usage of IS_ERR_OR_NULL() and
>> found 276 of them causes this warning in the v3.18 version of the kernel
>> that I am using
>>
>> $ grep -r "warning: testing a 'safe expression" * | wc -l
>> 276
>>
>> Can someone help me undestand what this means and how to fix the same?
>>
>> I run folling for CHECK
>>
>> make C=2 CF="-D__CHECK_ENDIAN__" CHECK=sparse
>
> If you can share your actual code or point to it in the tree, you
> might get more specific help.
>
> Bjorn

For example I get

   CHECK   drivers/pci/host/pci-keystone.c
include/linux/err.h:40:16: warning: testing a 'safe expression'

Actually it is for IS_ERR_OR_NULL() call in the file which is the only
one call in the file.

-- 
Murali Karicheri
Linux Kernel, Texas Instruments

  reply	other threads:[~2014-12-17 22:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 18:23 How to fix CHECK warning: testing a 'safe expression' Murali Karicheri
2014-12-17 16:18 ` How to fix CHECK warning: testing a 'safe expression' ? Murali Karicheri
2014-12-17 18:49   ` Bjorn Helgaas
2014-12-17 22:35     ` Murali Karicheri [this message]
2014-12-17 22:37       ` Murali Karicheri
2014-12-18  2:39         ` Christopher Li
2014-12-18 17:45           ` Murali Karicheri
2015-01-02 14:51 ` How to fix CHECK warning: testing a 'safe expression' Murali Karicheri
2015-01-02 22:20   ` Josh Triplett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54920529.4080007@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.