From owner-svn-src-all@FreeBSD.ORG Sun Dec 5 11:41:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1171D1065670; Sun, 5 Dec 2010 11:41:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id A0B7B8FC12; Sun, 5 Dec 2010 11:40:59 +0000 (UTC) Received: from c122-106-172-0.carlnfd1.nsw.optusnet.com.au (c122-106-172-0.carlnfd1.nsw.optusnet.com.au [122.106.172.0]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id oB5Betu7031442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 5 Dec 2010 22:40:57 +1100 Date: Sun, 5 Dec 2010 22:40:55 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Colin Percival In-Reply-To: <201012042336.oB4NaeID046811@svn.freebsd.org> Message-ID: <20101205222927.V981@besplex.bde.org> References: <201012042336.oB4NaeID046811@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r216191 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Dec 2010 11:41:00 -0000 On Sat, 4 Dec 2010, Colin Percival wrote: > Log: > Remove gratuitous i386/amd64 inconsistency in favour of the less verbose > version of declaring a variable initialized to zero. This is resolved backwardsly. style(9) forbids initializing variables in declarations (except for the bug in it which allows this). > Modified: head/sys/i386/i386/busdma_machdep.c > ============================================================================== > --- head/sys/i386/i386/busdma_machdep.c Sat Dec 4 23:24:35 2010 (r216190) > +++ head/sys/i386/i386/busdma_machdep.c Sat Dec 4 23:36:40 2010 (r216191) > @@ -858,7 +858,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, > bus_dmamap_callback2_t *callback, void *callback_arg, > int flags) > { > - bus_addr_t lastaddr; > + bus_addr_t lastaddr = 0; > int nsegs, error, first, i; > bus_size_t resid; > struct iovec *iov; > @@ -878,7 +878,6 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, > nsegs = 0; > error = 0; > first = 1; > - lastaddr = (bus_addr_t) 0; Also, here this is inconsisent with all the other initializations, since those actually follow style(9). Other style bugs visible in this patch: - the declarations are totally disordered. The initializations are at least in the same order as the declarations - the cast in the old initialization of `lastaddr' was followed by a space. It is unclear if this cast is needed, and the new initialization doesn't have it. It is not needed if bus_addr_t is a integer or pointer type, but bus_addr_t should be opaque. If it is a pointer type, then the variable is not initialized to zero, but to a null pointer. MD code like this can know what it is, but then you can't copy this code around. Some of the other functions in this file have larger style bugs in declarations/initializations than this. Bruce