lkml.org 
[lkml]   [2013]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: [next:akpm 798/1000] drivers/rtc/rtc-ds1286.c:343:24: sparse: incorrect type in argument 1 (different address spaces)
    From
    On Mon, Apr 22, 2013 at 4:56 PM, Andrew Morton
    <akpm@linux-foundation.org> wrote:
    > 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?

    Yes, the force attribute should silent the address check on conversion.

    Can some one try this patch (totally untested).

    Chris


    diff --git a/include/linux/err.h b/include/linux/err.h
    index f2edce2..d226a3c 100644
    --- a/include/linux/err.h
    +++ b/include/linux/err.h
    @@ -26,17 +26,17 @@ static inline void * __must_check ERR_PTR(long error)

    static inline long __must_check PTR_ERR(const void *ptr)
    {
    - return (long) ptr;
    + return (__force long) ptr;
    }

    static inline long __must_check IS_ERR(const void *ptr)
    {
    - return IS_ERR_VALUE((unsigned long)ptr);
    + return IS_ERR_VALUE((__force unsigned long)ptr);
    }

    static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
    {
    - return !ptr || IS_ERR_VALUE((unsigned long)ptr);
    + return !ptr || IS_ERR_VALUE((__force unsigned long)ptr);
    }

    /**

    \
     
     \ /
      Last update: 2013-04-23 05:21    [W:4.866 / U:0.568 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site