From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cvs.linux-mips.org (eddie.linux-mips.org [78.24.191.182]) by ozlabs.org (Postfix) with ESMTP id 179A1B7197 for ; Fri, 3 Sep 2010 01:26:45 +1000 (EST) Received: from localhost.localdomain ([127.0.0.1]:49015 "EHLO localhost.localdomain" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S1491020Ab0IBPUe (ORCPT ); Thu, 2 Sep 2010 17:20:34 +0200 Date: Thu, 2 Sep 2010 16:20:34 +0100 (BST) From: "Maciej W. Rozycki" To: Grant Likely Subject: Re: ERR_PTR pattern in phylib In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: netdev , Andy Fleming , linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, 1 Sep 2010, Grant Likely wrote: > I've been looking at the phylib code, and specifically at the use of > the ERR_PTR() pattern. I'm personally not a big fan of ERR_PTR() > because the compiler cannot type check the result and it runs > completely counter to the pattern "if (!ptr)" than is common for > testing a pointer return value. Arguably using a union here would make things cleaner and any reasonable ABI will place small unions used as arguments or return values in registers, but I'm not sure if the cost of the rewrite is worth the benefit. Probably not, but feel free to propose a change. Maciej