Commit 59859fb8 authored by Mark Haverkamp's avatar Mark Haverkamp Committed by James Bottomley

[PATCH] 2.6 aacraid: rx check health function update

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=3699Signed-off-by: default avatarMark Haverkamp <markh@osdl.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent d5d9292c
...@@ -274,7 +274,7 @@ static void aac_rx_start_adapter(struct aac_dev *dev) ...@@ -274,7 +274,7 @@ static void aac_rx_start_adapter(struct aac_dev *dev)
*/ */
static int aac_rx_check_health(struct aac_dev *dev) 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. * Check to see if the board failed any self tests.
...@@ -285,29 +285,39 @@ static int aac_rx_check_health(struct aac_dev *dev) ...@@ -285,29 +285,39 @@ static int aac_rx_check_health(struct aac_dev *dev)
* Check to see if the board panic'd. * Check to see if the board panic'd.
*/ */
if (status & KERNEL_PANIC) { if (status & KERNEL_PANIC) {
char * buffer = kmalloc(512, GFP_KERNEL); char * buffer;
struct POSTSTATUS { struct POSTSTATUS {
u32 Post_Command; u32 Post_Command;
u32 Post_Address; u32 Post_Address;
} * post = kmalloc(sizeof(struct POSTSTATUS), GFP_KERNEL); } * post;
dma_addr_t paddr = pci_map_single(dev->pdev, post, sizeof(struct POSTSTATUS), 2); dma_addr_t paddr, baddr;
dma_addr_t baddr = pci_map_single(dev->pdev, buffer, 512, 1); int ret;
u32 status = -1;
int ret = -2; if ((status & 0xFF000000L) == 0xBC000000L)
return (status >> 16) & 0xFF;
buffer = pci_alloc_consistent(dev->pdev, 512, &baddr);
ret = -2;
if (buffer == NULL)
return ret;
post = pci_alloc_consistent(dev->pdev,
sizeof(struct POSTSTATUS), &paddr);
if (post == NULL) {
pci_free_consistent(dev->pdev, 512, buffer, baddr);
return ret;
}
memset(buffer, 0, 512); memset(buffer, 0, 512);
post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS); post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS);
post->Post_Address = cpu_to_le32(baddr); post->Post_Address = cpu_to_le32(baddr);
rx_writel(dev, MUnit.IMRx[0], cpu_to_le32(paddr)); rx_writel(dev, MUnit.IMRx[0], cpu_to_le32(paddr));
rx_sync_cmd(dev, COMMAND_POST_RESULTS, baddr, &status); rx_sync_cmd(dev, COMMAND_POST_RESULTS, baddr, &status);
pci_unmap_single(dev->pdev, paddr, sizeof(struct POSTSTATUS), 2); pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
kfree(post); post, paddr);
if ((buffer[0] == '0') && (buffer[1] == 'x')) { if ((buffer[0] == '0') && (buffer[1] == 'x')) {
ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10);
ret <<= 4; ret <<= 4;
ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10);
} }
pci_unmap_single(dev->pdev, baddr, 512, 1); pci_free_consistent(dev->pdev, 512, buffer, baddr);
kfree(buffer);
return ret; return ret;
} }
/* /*
...@@ -319,7 +329,7 @@ static int aac_rx_check_health(struct aac_dev *dev) ...@@ -319,7 +329,7 @@ static int aac_rx_check_health(struct aac_dev *dev)
* Everything is OK * Everything is OK
*/ */
return 0; return 0;
} /* aac_rx_check_health */ }
/** /**
* aac_rx_init - initialize an i960 based AAC card * aac_rx_init - initialize an i960 based AAC card
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment