From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423113AbcFMQzz (ORCPT ); Mon, 13 Jun 2016 12:55:55 -0400 Received: from mga03.intel.com ([134.134.136.65]:28737 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423067AbcFMQzt (ORCPT ); Mon, 13 Jun 2016 12:55:49 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,467,1459839600"; d="scan'208";a="996711311" Date: Mon, 13 Jun 2016 22:32:29 +0530 From: Vinod Koul To: Arnd Bergmann Cc: Dan Williams , Michal Simek , =?iso-8859-1?Q?S=F6ren?= Brinkmann , Kedareswara rao Appana , Laurent Pinchart , dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dma: xilinx-vdma: add some sanity checks Message-ID: <20160613170229.GJ16910@localhost> References: <1465830523-2484498-1-git-send-email-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1465830523-2484498-1-git-send-email-arnd@arndb.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 13, 2016 at 05:07:33PM +0200, Arnd Bergmann wrote: > The newly added xilinx_dma_prep_dma_cyclic function sometimes causes > a gcc warning about the use of the segment function in case > we never run into the inner loop of the function: > > dma/xilinx/xilinx_vdma.c: In function 'xilinx_dma_prep_dma_cyclic': > dma/xilinx/xilinx_vdma.c:1808:23: error: 'segment' may be used uninitialized in this function [-Werror=maybe-uninitialized] > segment->hw.control |= XILINX_DMA_BD_SOP; > > This can only happen if the period len is zero (which would cause other > problems earlier), or if the buffer is shorter than a period. Neither > of them should ever happen, but by adding an explicit check for these two > cases, we can abort in a more controlled way, and the compiler is > able to see that we never use uninitialized data. Applied after fixing subsystem name Thanks -- ~Vinod