From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: [PATCH] 2.6 aacraid: rx check health function update Date: Fri, 5 Nov 2004 08:25:24 +0100 Message-ID: <20041105072524.GD16649@suse.de> References: <1099613392.6249.16.camel@markh1.pdx.osdl.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from ns.virtualhost.dk ([195.184.98.160]:64190 "EHLO virtualhost.dk") by vger.kernel.org with ESMTP id S262653AbUKEHZ6 (ORCPT ); Fri, 5 Nov 2004 02:25:58 -0500 Content-Disposition: inline In-Reply-To: <1099613392.6249.16.camel@markh1.pdx.osdl.net> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: Mark Haverkamp Cc: James Bottomley , linux-scsi , Mark Salyzyn On Thu, Nov 04 2004, Mark Haverkamp wrote: > This patch updates the rx check health function. My previous only > updated the rkt check health code. This and the previous patch should > fix the kmalloc return checking bug: > > http://bugme.osdl.org/show_bug.cgi?id=3699 > > Signed-off-by: Mark Haverkamp > > > ===== drivers/scsi/aacraid/rx.c 1.12 vs edited ===== > --- 1.12/drivers/scsi/aacraid/rx.c 2004-11-04 09:32:56 -08:00 > +++ edited/drivers/scsi/aacraid/rx.c 2004-11-04 09:37:33 -08:00 > @@ -274,7 +274,7 @@ > */ > static int aac_rx_check_health(struct aac_dev *dev) > { > - long status = rx_readl(dev, IndexRegs.Mailbox[7]); > + u32 status = le32_to_cpu(rx_readl(dev, MUnit.OMRx[0])); > > /* > * Check to see if the board failed any self tests. > @@ -285,29 +285,39 @@ > * Check to see if the board panic'd. > */ > if (status & KERNEL_PANIC) { > - char * buffer = kmalloc(512, GFP_KERNEL); > + char * buffer; > struct POSTSTATUS { > u32 Post_Command; > u32 Post_Address; > - } * post = kmalloc(sizeof(struct POSTSTATUS), GFP_KERNEL); > - dma_addr_t paddr = pci_map_single(dev->pdev, post, sizeof(struct POSTSTATUS), 2); > - dma_addr_t baddr = pci_map_single(dev->pdev, buffer, 512, 1); > - u32 status = -1; > - int ret = -2; > + } * post; > + dma_addr_t paddr, baddr; > + int ret; > + > + if ((status & 0xFF000000L) == 0xBC000000L) > + return (status >> 16) & 0xFF; > + buffer = pci_alloc_consistent(dev->pdev, 512, &baddr); > + ret = -2; > + if (buffer == NULL) > + return ret; I don't think it's a good idea to return bad adapter health, because you have an allocation failure. -- Jens Axboe