From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD26DC43387 for ; Mon, 31 Dec 2018 19:56:15 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6902521019 for ; Mon, 31 Dec 2018 19:56:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=crashcourse.ca header.i=@crashcourse.ca header.b="ilfO7Odo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6902521019 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=crashcourse.ca Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1ge3fa-0005Gl-1S for kernelnewbies@archiver.kernel.org; Mon, 31 Dec 2018 14:56:14 -0500 Received: from cpanel4.indieserve.net ([199.212.143.9]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1ge3df-00032S-2P for kernelnewbies@kernelnewbies.org; Mon, 31 Dec 2018 14:54:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crashcourse.ca; s=default; h=Content-Type:MIME-Version:Message-ID:Subject: To:From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=EDWG50F9M/v792susG8PpOmeOG9L7ipXp7nSTE01hTw=; b=ilfO7OdoZ6gJmcVkUxFRppuVPN 8pEITTTiodnQjva+xOJqb8bc46XC6KScYsJfn3MLXAQzqSYPGWsDgORpz5gXjAWlYAXI00joYHlIA Ph5IYDwH8b33/CRY/gU9MHGLHYfm5ZCKISYzQV+zARyaVaHo+tnvB1OnZsTYYOXPWQjtxbzn60qas b4rbkmLwMpAhJcD21SErE/Pes/tPn+Y7oLRB6TMFEipYfDDJt0Ig8sqTochuU+FpahPVaEzP8ktgE Tvt9uGqNvx0WyPHdlCeT+UvsHIYmMNRuab5rzQXVGQ+aCEZf/ZItJehr3If+eHe5BaPNnTVsrbJzi hugyCJVQ==; Received: from cpef81d0f814063-cmf81d0f814060.cpe.net.cable.rogers.com ([174.114.57.56]:56646 helo=localhost.localdomain) by cpanel4.indieserve.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1ge3dc-00DeRy-0M for kernelnewbies@kernelnewbies.org; Mon, 31 Dec 2018 14:54:12 -0500 Date: Mon, 31 Dec 2018 14:53:23 -0500 (EST) From: "Robert P. J. Day" X-X-Sender: rpjday@localhost.localdomain To: Kernel Newbies Subject: stylistically, IS_ERR() versus IS_ERR_VALUE()? Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 X-OutGoing-Spam-Status: No, score=-0.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel4.indieserve.net X-AntiAbuse: Original Domain - kernelnewbies.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - crashcourse.ca X-Get-Message-Sender-Via: cpanel4.indieserve.net: authenticated_id: rpjday+crashcourse.ca/only user confirmed/virtual account not confirmed X-Authenticated-Sender: cpanel4.indieserve.net: rpjday@crashcourse.ca X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces+kernelnewbies=archiver.kernel.org@kernelnewbies.org poking around error handling in the kernel, and noticed the following ... in include/linux/err.h, we have IS_ERR() unsurprisingly defined in terms of IS_ERR_VALUE(): #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= \ (unsigned long)-MAX_ERRNO) ... snip ... static inline bool __must_check IS_ERR(__force const void *ptr) { return IS_ERR_VALUE((unsigned long)ptr); } fair enough, and the above suggests that it's technically equivalent to use either one, but if i search under drivers/ for each: $ git grep -w IS_ERR -- drivers | wc -l 14048 $ $ git grep -w IS_ERR_VALUE -- drivers | wc -l 48 $ so IS_ERR() is pretty clearly the call of choice, and the invocations of IS_ERR_VALUE() are concentrated in a small number of files -- heck, 15 of those calls are in the single file drivers/net/ethernet/freescale/ucc_geth.c. is there any non-obvious reason for driver code to use the latter? superficially, they *seem* to be equivalent, but i've been surprised before. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca/dokuwiki Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies