scsi: 53c700: pass correct "dev" to dma_alloc_attrs() [Linux 5.0]

This Linux kernel change "scsi: 53c700: pass correct “dev” to dma_alloc_attrs()" is included in the Linux 5.0 release. This change is authored by Dan Carpenter <dan.carpenter [at] oracle.com> on Thu Jan 24 13:33:27 2019 +0300. The commit for this change in Linux stable tree is 8437fcf (patch).

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

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 <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

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

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 128d658..16957d7 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -295,7 +295,7 @@ struct Scsi_Host *
    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");

Leave a Reply

Your email address will not be published. Required fields are marked *