linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jingoo Han <jg1.han@samsung.com>,
	kbuild-all@01.org, linux-sparse@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [next:akpm 798/1000] drivers/rtc/rtc-ds1286.c:343:24: sparse: incorrect type in argument 1 (different address spaces)
Date: Tue, 23 Apr 2013 10:51:43 +0800	[thread overview]
Message-ID: <20130423025143.GC7154@localhost> (raw)
In-Reply-To: <20130422165629.bae79e6c5251bf148a3bae73@linux-foundation.org>

On Mon, Apr 22, 2013 at 04:56:29PM -0700, Andrew Morton wrote:
> On Sat, 20 Apr 2013 07:54:34 +0800 kbuild test robot <fengguang.wu@intel.com> wrote:
> 
> > tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm
> > head:   c9941b7ec7840ad33f5822c7f238157558d40132
> > commit: d5e42b5769899607e1e4b0c9200340d24f370e8c [798/1000] rtc: rtc-ds1286: use devm_*() functions
> > 
> > 
> > sparse warnings: (new ones prefixed by >>)
> > 
> > >> drivers/rtc/rtc-ds1286.c:343:24: sparse: incorrect type in argument 1 (different address spaces)
> >    drivers/rtc/rtc-ds1286.c:343:24:    expected void const *ptr
> >    drivers/rtc/rtc-ds1286.c:343:24:    got unsigned int [noderef] [usertype] <asn:2>*rtcregs
> > >> drivers/rtc/rtc-ds1286.c:344:36: sparse: incorrect type in argument 1 (different address spaces)
> >    drivers/rtc/rtc-ds1286.c:344:36:    expected void const *ptr
> >    drivers/rtc/rtc-ds1286.c:344:36:    got unsigned int [noderef] [usertype] <asn:2>*rtcregs
> > 
> > vim +343 drivers/rtc/rtc-ds1286.c
> > 
> >    337			return -ENODEV;
> >    338		priv = devm_kzalloc(&pdev->dev, sizeof(struct ds1286_priv), GFP_KERNEL);
> >    339		if (!priv)
> >    340			return -ENOMEM;
> >    341	
> >    342		priv->rtcregs = devm_ioremap_resource(&pdev->dev, res);
> >  > 343		if (IS_ERR(priv->rtcregs))
> >  > 344			return PTR_ERR(priv->rtcregs);
> >    345	
> >    346		spin_lock_init(&priv->lock);
> >    347		platform_set_drvdata(pdev, priv);
> 
> I think doing IS_ERR() and PTR_ERR() on __iomem pointers is a natural
> thing, and we should be able to do this without adding call-site
> trickery to make sparse happy.
> 
> Is there some sort of annotation which we can add to the
> IS_ERR()/PTR_ERR() definitions so that sparse will stop warning about
> this usage?

If it's too hard to fix in sparse, I can add a check in my scripts,
ignoring all "parse: incorrect type in argument 1 (different address
spaces)" warnings in the IS_ERR/PTR_ERR lines.

Thanks,
Fengguang

  reply	other threads:[~2013-04-23  2:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5171d93a.0NZAGYYKNj8hjsAs%fengguang.wu@intel.com>
2013-04-22 23:56 ` [next:akpm 798/1000] drivers/rtc/rtc-ds1286.c:343:24: sparse: incorrect type in argument 1 (different address spaces) Andrew Morton
2013-04-23  2:51   ` Fengguang Wu [this message]
2013-04-23  2:56   ` Christopher Li
2013-04-23  6:16     ` Dan Carpenter
2013-04-26  2:09       ` [PATCH] forced argument Was " Christopher Li
2013-04-26  6:35         ` Dan Carpenter

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=20130423025143.GC7154@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=jg1.han@samsung.com \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).