diff mbox series

scsi: 53c700: pass correct "dev" to dma_alloc_attrs()

Message ID 20190124103327.GB25529@kadam (mailing list archive)
State Mainlined
Commit 8437fcf14deed67e5ad90b5e8abf62fb20f30881
Headers show
Series scsi: 53c700: pass correct "dev" to dma_alloc_attrs() | expand

Commit Message

Dan Carpenter Jan. 24, 2019, 10:33 a.m. UTC
The "hostdata->dev" pointer is NULL here.  We set "hostdata->dev = dev;"
later in the function and we also use "hostdata->dev" when we call
dma_free_attrs() in NCR_700_release().

This bug predates git version control.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I just noticed this when I was reviewing some static checker stuff.  I
have not tested it.


 drivers/scsi/53c700.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin K. Petersen Jan. 29, 2019, 6:33 a.m. UTC | #1
Dan,

> The "hostdata->dev" pointer is NULL here.  We set "hostdata->dev = dev;"
> later in the function and we also use "hostdata->dev" when we call
> dma_free_attrs() in NCR_700_release().
>
> This bug predates git version control.

Applied to 5.0/scsi-fixes, thank you!
diff mbox series

Patch

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 128d658d472a..16957d7ac414 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -295,7 +295,7 @@  NCR_700_detect(struct scsi_host_template *tpnt,
 	if(tpnt->sdev_attrs == NULL)
 		tpnt->sdev_attrs = NCR_700_dev_attrs;
 
-	memory = dma_alloc_attrs(hostdata->dev, TOTAL_MEM_SIZE, &pScript,
+	memory = dma_alloc_attrs(dev, TOTAL_MEM_SIZE, &pScript,
 				 GFP_KERNEL, DMA_ATTR_NON_CONSISTENT);
 	if(memory == NULL) {
 		printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n");