From patchwork Tue Apr 23 02:56:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 2475261 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 21B90DF23A for ; Tue, 23 Apr 2013 02:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754190Ab3DWC4U (ORCPT ); Mon, 22 Apr 2013 22:56:20 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]:35620 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754056Ab3DWC4T (ORCPT ); Mon, 22 Apr 2013 22:56:19 -0400 Received: by mail-oa0-f46.google.com with SMTP id k3so138639oag.19 for ; Mon, 22 Apr 2013 19:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=G14H16lOp/fh93tiqgVcN2vXl4EyzRNoE2QgHBffCcQ=; b=um8Lo4jfvTbVB3NkBsSDitU+lJ8liyjrVVXV50PYyScIBzAtzuCkJcNlU3/C5nuquX MbxaG8/KGWuBjfysIUl7IqL/lwVtJcmoXNNio9Y/Xlwy2Nipk+g3kQSPwOCtpyuAvzlh e8dAQDjr57Rwc+FxOZRuj4SG6WNjdZtlFqh/hyjQYtd97vbqSAzw/lRPblA5Ca454mF5 XzGdMOwpq9FTpKXh/wfZ1mV6l358L9c4ABCR0ATDEQLfylIAoCM2YCifN1tHL8dass88 zLhmzwBI3kKUKfmT3d+Ik2If436kji1on8c27hpXIkPa2VL6I6Z7WzOqsnQ7V07qi7ci nDyw== MIME-Version: 1.0 X-Received: by 10.182.60.136 with SMTP id h8mr15685337obr.47.1366685779247; Mon, 22 Apr 2013 19:56:19 -0700 (PDT) Received: by 10.182.11.40 with HTTP; Mon, 22 Apr 2013 19:56:19 -0700 (PDT) In-Reply-To: <20130422165629.bae79e6c5251bf148a3bae73@linux-foundation.org> References: <5171d93a.0NZAGYYKNj8hjsAs%fengguang.wu@intel.com> <20130422165629.bae79e6c5251bf148a3bae73@linux-foundation.org> Date: Mon, 22 Apr 2013 19:56:19 -0700 X-Google-Sender-Auth: j1k9dBSMX_-N4lIX9QvwTOWFoj0 Message-ID: Subject: Re: [next:akpm 798/1000] drivers/rtc/rtc-ds1286.c:343:24: sparse: incorrect type in argument 1 (different address spaces) From: Christopher Li To: Andrew Morton Cc: kbuild test robot , Jingoo Han , kbuild-all@01.org, Linux-Sparse , linux-kernel Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org On Mon, Apr 22, 2013 at 4:56 PM, Andrew Morton 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 --- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); } /**