Skip to contentSkip to conversation

Two small fixes for sym53c8xx_2

PATCH New Matthew Wilcox 1 participant 1 message Feb 11, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Two small fixes for sym53c8xx_2

Both of these patches are originally by Grant Grundler. They've been tested in the PA-RISC tree for a few months, and I'm forwarding them along.

First patch:

pci_set_dma_mask returns 0 if the card can perform DMA as specified, so the sense of the test is wrong.

drivers/scsi/sym53c8xx_2/sym_glue.c +1 -1
diff -urpNX build-tools/dontdiff linus-2.5/drivers/scsi/sym53c8xx_2/sym_glue.c parisc-2.5/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1876,7 +1876,7 @@ static int sym_setup_bus_dma_mask(hcb_p 
 					sym_name(np));
 		}
 		else {
-			if (!pci_set_dma_mask(np->s.device, 0xffffffffUL))
+			if (pci_set_dma_mask(np->s.device, 0xffffffffUL))
 				goto out_err32;
 		}
 	}

Second patch:

Here's the cvs log message Grant used when committing it:

2.4.18-pa57 fix sym53c8xx_2 "giving up" data page fault c3k has a narrow Bus and the sym53c8xx_2 doesn't know that. It trips over bad parity, prints "giving up..." msg and then data page faults (code 15). Problem is coalescing of free'd data buffers exceeds the max size the driver is expecting to handle and walk off the end of an array (h[i]) of pointers.

drivers/scsi/sym53c8xx_2/sym_malloc.c +5 -2
diff -urpNX build-tools/dontdiff linus-2.5/drivers/scsi/sym53c8xx_2/sym_malloc.c parisc-2.5/drivers/scsi/sym53c8xx_2/sym_malloc.c
@@ -143,12 +143,15 @@ static void ___sym_mfree(m_pool_p mp, vo
 	a = (m_addr_t) ptr;
 
 	while (1) {
-#ifdef SYM_MEM_FREE_UNUSED
 		if (s == SYM_MEM_CLUSTER_SIZE) {
+#ifdef SYM_MEM_FREE_UNUSED
 			M_FREE_MEM_CLUSTER(a);
+#else
+			((m_link_p) a)->next = h[i].next;
+			h[i].next = (m_link_p) a;
+#endif
 			break;
 		}
-#endif
 		b = a ^ s;
 		q = &h[i];
 		while (q->next && q->next != (m_link_p) b) {
Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk