From 561628d3020bc399626e65fdcbc822160a2993ad Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Thu, 2 May 2024 17:45:43 -0700 Subject: [PATCH 1/2] Improve error handling in DataDev_Probe and DataGpu_Probe Kernel docs say if dma_set_mask or dma_set_coherent_mask fail, the driver should avoid using DMA at all for the device. That is now considered an error in this code. Unified the error handling paths to reduce duplicated code On error, we also now clear the slot we used in gDmaDevices. This avoids a super rare failure case where we run out of slots in the array due to cards that fail to init properly (i.e. dma_set_xxx failing, or some other error path in DataXXX_Probe) --- data_dev/driver/src/data_dev_top.c | 30 ++++++++++++++++--------- data_gpu/driver/src/data_gpu_top.c | 35 ++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/data_dev/driver/src/data_dev_top.c b/data_dev/driver/src/data_dev_top.c index 2ad94a7..03b6d69 100755 --- a/data_dev/driver/src/data_dev_top.c +++ b/data_dev/driver/src/data_dev_top.c @@ -201,14 +201,16 @@ int DataDev_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { } if (ret < 0 || ret >= sizeof(dev->devName)) { pr_err("%s: Probe: Error in snprintf() while formatting device name\n", MOD_NAME); - return -EINVAL; // Return directly with an error code + probeReturn = -EINVAL; + goto err_pre_en; // Bail out, but clean up first } // Activate the PCI device ret = pci_enable_device(pcidev); if (ret) { pr_err("%s: Probe: pci_enable_device() = %i.\n", MOD_NAME, ret); - return ret; // Return with error code + probeReturn = ret; // Return directly with error code + goto err_pre_en; // Bail out, but clean up first } pci_set_master(pcidev); // Set the device as bus master @@ -218,9 +220,8 @@ int DataDev_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { // Map the device's register space for use in the driver if ( Dma_MapReg(dev) < 0 ) { - pci_disable_device(pcidev); // Disable the device on failure probeReturn = -ENOMEM; // Memory allocation error - return probeReturn; + goto err_post_en; } // Initialize device configuration parameters @@ -270,32 +271,41 @@ int DataDev_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { if (!dma_set_coherent_mask(dev->device, DMA_BIT_MASK(axiWidth))) { dev_info(dev->device, "Init: Using %d-bit coherent DMA mask.\n", axiWidth); } else { - dev_warn(dev->device, "Init: Failed to set coherent DMA mask.\n"); + dev_err(dev->device, "Init: Failed to set coherent DMA mask.\n"); + probeReturn = -EINVAL; + goto err_post_en; } } else { - dev_warn(dev->device, "Init: Failed to set DMA mask.\n"); + dev_err(dev->device, "Init: Failed to set DMA mask.\n"); + probeReturn = -EINVAL; + goto err_post_en; } } // Initialize common DMA functionalities if (Dma_Init(dev) < 0) { - pci_disable_device(pcidev); // Disable PCI device on failure probeReturn = -ENOMEM; // Indicate memory allocation error - return probeReturn; + goto err_post_en; } // Get hardware data structure hwData = (struct AxisG2Data *)dev->hwData; // Log memory mapping information - dev_info(dev->device,"Init: Reg space mapped to 0x%llx.\n",(uint64_t)dev->reg); - dev_info(dev->device,"Init: User space mapped to 0x%llx with size 0x%x.\n",(uint64_t)dev->rwBase,dev->rwSize); + dev_info(dev->device,"Init: Reg space mapped to 0x%p.\n",dev->reg); + dev_info(dev->device,"Init: User space mapped to 0x%p with size 0x%x.\n",dev->rwBase,dev->rwSize); dev_info(dev->device,"Init: Top Register = 0x%x\n",readl(dev->reg)); // Finalize device probe successfully gDmaDevCount++; // Increment global device count probeReturn = 0; // Set successful return code return probeReturn; // Return success + +err_post_en: + pci_disable_device(pcidev); // Disable PCI device on failure +err_pre_en: + memset(dev, 0, sizeof(*dev)); // Clear out the slot we took in gDmaDevices + return probeReturn; } /** diff --git a/data_gpu/driver/src/data_gpu_top.c b/data_gpu/driver/src/data_gpu_top.c index d4cf654..615a94c 100755 --- a/data_gpu/driver/src/data_gpu_top.c +++ b/data_gpu/driver/src/data_gpu_top.c @@ -136,6 +136,7 @@ int DataGpu_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { int32_t x; int32_t axiWidth; int ret; + int probeReturn = 0; // Validate buffer mode configuration if ( cfgMode != BUFF_COHERENT && cfgMode != BUFF_STREAM ) { @@ -180,14 +181,16 @@ int DataGpu_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { } if (ret < 0 || ret >= sizeof(dev->devName)) { pr_err("%s: Probe: Error in snprintf() while formatting device name\n", MOD_NAME); - return -EINVAL; // Return directly with an error code + probeReturn = -EINVAL; // Return directly with an error code + goto err_pre_en; } // Activate the PCI device ret = pci_enable_device(pcidev); if (ret) { pr_err("%s: Probe: pci_enable_device() = %i.\n", MOD_NAME, ret); - return ret; // Return with error code + probeReturn = ret; // Return with error code + goto err_pre_en; } pci_set_master(pcidev); // Set the device as bus master @@ -197,8 +200,8 @@ int DataGpu_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { // Map the device's register space for use in the driver if ( Dma_MapReg(dev) < 0 ) { - pci_disable_device(pcidev); // Disable the device on failure - return -ENOMEM; // Memory allocation error + probeReturn = -ENOMEM; // Memory allocation error + goto err_post_en; } // Initialize device configuration parameters @@ -241,27 +244,37 @@ int DataGpu_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) { if (!dma_set_coherent_mask(dev->device, DMA_BIT_MASK(axiWidth))) { dev_info(dev->device, "Init: Using %d-bit coherent DMA mask.\n", axiWidth); } else { - dev_warn(dev->device, "Init: Failed to set coherent DMA mask.\n"); + dev_err(dev->device, "Init: Failed to set coherent DMA mask.\n"); + probeReturn = -EINVAL; + goto err_post_en; } } else { - dev_warn(dev->device, "Init: Failed to set DMA mask.\n"); + dev_err(dev->device, "Init: Failed to set DMA mask.\n"); + probeReturn = -EINVAL; + goto err_post_en; } } // Initialize common DMA functionalities if (Dma_Init(dev) < 0) { - pci_disable_device(pcidev); // Disable PCI device on failure - return -ENOMEM; // Indicate memory allocation error + probeReturn = -ENOMEM; // Indicate memory allocation error + goto err_post_en; } // Log memory mapping information - dev_info(dev->device,"Init: Reg space mapped to 0x%llx.\n",(uint64_t)dev->reg); - dev_info(dev->device,"Init: User space mapped to 0x%llx with size 0x%x.\n",(uint64_t)dev->rwBase,dev->rwSize); + dev_info(dev->device,"Init: Reg space mapped to 0x%p.\n",dev->reg); + dev_info(dev->device,"Init: User space mapped to 0x%p with size 0x%x.\n",dev->rwBase,dev->rwSize); dev_info(dev->device,"Init: Top Register = 0x%x\n",readl(dev->reg)); // Finalize device probe successfully gDmaDevCount++; // Increment global device count - return(0); // Success + return 0; // Success + +err_post_en: + pci_disable_device(pcidev); // Disable PCI device on failure +err_pre_en: + memset(dev, 0, sizeof(*dev)); // Clear out the slot we took over in gDmaDevices + return probeReturn; } /** From 3f066002eff4f1495ac4e65b053d93af54413710 Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Thu, 2 May 2024 18:31:03 -0700 Subject: [PATCH 2/2] Stylistic cleanup: return() -> return --- common/driver/dma_buffer.c | 50 ++++++++++++++-------------- common/driver/dma_common.c | 68 +++++++++++++++++++------------------- common/driver/gpu_async.c | 6 ++-- 3 files changed, 62 insertions(+), 62 deletions(-) diff --git a/common/driver/dma_buffer.c b/common/driver/dma_buffer.c index fcae6e2..467cdc9 100755 --- a/common/driver/dma_buffer.c +++ b/common/driver/dma_buffer.c @@ -61,7 +61,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list, list->dev = dev; list->baseIdx = baseIdx; - if ( count == 0 ) return(0); + if ( count == 0 ) return 0; // Allocate first level pointers if ((list->indexed = (struct DmaBuffer ***) kzalloc(sizeof(struct DmaBuffer**) * list->subCount, GFP_KERNEL)) == NULL ) { @@ -139,7 +139,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list, // Sort the buffers if ( list->sorted != NULL ) sort(list->sorted,list->count,sizeof(struct DmaBuffer *),dmaSortComp,NULL); - return(list->count); + return list->count; /* Cleanup */ cleanup_buffers: @@ -329,11 +329,11 @@ struct DmaBuffer *dmaFindBufferList(struct DmaBufferList *list, dma_addr_t handl sl = x / BUFFERS_PER_LIST; sli = x % BUFFERS_PER_LIST; if (list->indexed[sl][sli]->buffHandle == handle) { - return(list->indexed[sl][sli]); + return list->indexed[sl][sli]; } } // Buffer not found in unsorted list - return(NULL); + return NULL; } // Handle sorted list case: binary search for efficiency else { @@ -342,9 +342,9 @@ struct DmaBuffer *dmaFindBufferList(struct DmaBufferList *list, dma_addr_t handl if (result == NULL) { // Buffer not found in sorted list - return(NULL); + return NULL; } else { - return((*result)); + return *result; } } } @@ -362,9 +362,9 @@ struct DmaBuffer *dmaFindBufferList(struct DmaBufferList *list, dma_addr_t handl struct DmaBuffer *dmaFindBuffer(struct DmaDevice *dev, dma_addr_t handle) { struct DmaBuffer *buff; - if ((buff = dmaFindBufferList(&(dev->txBuffers), handle)) != NULL) return(buff); - if ((buff = dmaFindBufferList(&(dev->rxBuffers), handle)) != NULL) return(buff); - return(NULL); + if ((buff = dmaFindBufferList(&(dev->txBuffers), handle)) != NULL) return buff; + if ((buff = dmaFindBufferList(&(dev->rxBuffers), handle)) != NULL) return buff; + return NULL; } /** @@ -382,11 +382,11 @@ struct DmaBuffer *dmaGetBufferList(struct DmaBufferList *list, uint32_t index) { uint32_t sl; uint32_t sli; - if (index < list->baseIdx || index >= (list->baseIdx + list->count)) return(NULL); + if (index < list->baseIdx || index >= (list->baseIdx + list->count)) return NULL; else { sl = (index - list->baseIdx) / BUFFERS_PER_LIST; sli = (index - list->baseIdx) % BUFFERS_PER_LIST; - return(list->indexed[sl][sli]); + return list->indexed[sl][sli]; } } @@ -402,9 +402,9 @@ struct DmaBuffer *dmaGetBufferList(struct DmaBufferList *list, uint32_t index) { */ struct DmaBuffer *dmaGetBuffer(struct DmaDevice *dev, uint32_t index) { struct DmaBuffer *buff; - if ((buff = dmaGetBufferList(&(dev->txBuffers), index)) != NULL) return(buff); - if ((buff = dmaGetBufferList(&(dev->rxBuffers), index)) != NULL) return(buff); - return(NULL); + if ((buff = dmaGetBufferList(&(dev->txBuffers), index)) != NULL) return buff; + if ((buff = dmaGetBufferList(&(dev->rxBuffers), index)) != NULL) return buff; + return NULL; } /** @@ -428,16 +428,16 @@ struct DmaBuffer *dmaRetBufferIrq(struct DmaDevice *dev, dma_addr_t handle) { if ((buff = dmaFindBufferList(&(dev->txBuffers), handle)) != NULL) { dmaBufferFromHw(buff); // Prepare buffer for hardware interaction dmaQueuePushIrq(&(dev->tq), buff); // Re-queue the buffer - return (NULL); + return NULL; } // Attempt to return rx buffer if found in receive list else if ((buff = dmaFindBufferList(&(dev->rxBuffers), handle)) != NULL) { - return (buff); + return buff; } // Log warning if buffer is not found in either list else { dev_warn(dev->device, "dmaRetBufferIrq: Failed to locate descriptor %.8x.\n", (uint32_t)handle); - return (NULL); + return NULL; } } @@ -463,16 +463,16 @@ struct DmaBuffer *dmaRetBufferIdx(struct DmaDevice *dev, uint32_t index) { if ((buff = dmaGetBufferList(&(dev->txBuffers), index)) != NULL) { dmaBufferFromHw(buff); dmaQueuePush(&(dev->tq), buff); - return (NULL); + return NULL; } // Attempt to retrieve and return the buffer from the receive queue else if ((buff = dmaGetBufferList(&(dev->rxBuffers), index)) != NULL) { - return (buff); + return buff; } // Log warning if the buffer cannot be found in either queue else { dev_warn(dev->device, "dmaRetBufferIdx: Failed to locate descriptor %i.\n", index); - return (NULL); + return NULL; } } @@ -498,16 +498,16 @@ struct DmaBuffer *dmaRetBufferIdxIrq(struct DmaDevice *dev, uint32_t index) { if ((buff = dmaGetBufferList(&(dev->txBuffers), index)) != NULL) { dmaBufferFromHw(buff); dmaQueuePushIrq(&(dev->tq), buff); - return (NULL); + return NULL; } // Attempt to return buffer from receive queue if found else if ((buff = dmaGetBufferList(&(dev->rxBuffers), index)) != NULL) { - return (buff); + return buff; } // Log warning if buffer is not found in either list else { dev_warn(dev->device, "dmaRetBufferIdxIrq: Failed to locate descriptor %i.\n", index); - return (NULL); + return NULL; } } @@ -910,7 +910,7 @@ struct DmaBuffer * dmaQueuePop ( struct DmaQueue *queue ) { ret->inQ = 0; } spin_unlock_irqrestore(&(queue->lock),iflags); - return(ret); + return ret; } /** @@ -1027,7 +1027,7 @@ ssize_t dmaQueuePopListIrq(struct DmaQueue *queue, struct DmaBuffer **buff, size // Unlock the queue after operation spin_unlock(&(queue->lock)); - return(ret); + return ret; } /** diff --git a/common/driver/dma_common.c b/common/driver/dma_common.c index 1028852..ece33d8 100755 --- a/common/driver/dma_common.c +++ b/common/driver/dma_common.c @@ -226,7 +226,7 @@ int Dma_Init(struct DmaDevice *dev) { res = alloc_chrdev_region(&(dev->devNum), 0, 1, dev->devName); if (res < 0) { dev_err(dev->device,"Init: Cannot register char device\n"); - return(-1); + return -1; } // Initialize the device @@ -816,12 +816,12 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { // Get buffer count case DMA_Get_Buff_Count: - return(dev->rxBuffers.count + dev->txBuffers.count); + return dev->rxBuffers.count + dev->txBuffers.count; break; // Get rx buffer count case DMA_Get_RxBuff_Count: - return(dev->rxBuffers.count); + return dev->rxBuffers.count; break; // Get rx buffer in User count @@ -831,7 +831,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->rxBuffers),x); if ( buff->userHas ) userCnt++; } - return(userCnt); + return userCnt; break; // Get rx buffer in HW count @@ -841,7 +841,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->rxBuffers),x); if ( buff->inHw && (!buff->inQ) ) hwCnt++; } - return(hwCnt); + return hwCnt; break; // Get rx buffer in Pre-HW Queue count @@ -851,7 +851,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->rxBuffers),x); if ( buff->inHw && buff->inQ ) hwQCnt++; } - return(hwQCnt); + return hwQCnt; break; // Get rx buffer in SW Queue count @@ -861,7 +861,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->rxBuffers),x); if ( (!buff->inHw) && buff->inQ ) qCnt++; } - return(qCnt); + return qCnt; break; // Get rx buffer missing count @@ -871,12 +871,12 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->rxBuffers),x); if ( (buff->userHas==NULL) && (buff->inHw==0) && (buff->inQ==0) ) miss++; } - return(miss); + return miss; break; // Get tx buffer count case DMA_Get_TxBuff_Count: - return(dev->txBuffers.count); + return dev->txBuffers.count; break; // Get tx buffer in User count @@ -886,7 +886,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->txBuffers),x); if ( buff->userHas ) userCnt++; } - return(userCnt); + return userCnt; break; // Get tx buffer in HW count @@ -896,7 +896,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->txBuffers),x); if ( buff->inHw && (!buff->inQ) ) hwCnt++; } - return(hwCnt); + return hwCnt; break; // Get tx buffer in Pre-HW Queue count @@ -906,7 +906,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->txBuffers),x); if ( buff->inHw && buff->inQ ) hwQCnt++; } - return(hwQCnt); + return hwQCnt; break; // Get tx buffer in SW Queue count @@ -916,7 +916,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->txBuffers),x); if ( (!buff->inHw) && buff->inQ ) qCnt++; } - return(qCnt); + return qCnt; break; // Get tx buffer missing count @@ -926,46 +926,46 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaGetBufferList(&(dev->txBuffers),x); if ( (buff->userHas==NULL) && (buff->inHw==0) && (buff->inQ==0) ) miss++; } - return(miss); + return miss; break; // Get buffer size, same size for rx and tx case DMA_Get_Buff_Size: - return(dev->cfgSize); + return dev->cfgSize; break; // Check if read is ready case DMA_Read_Ready: - return(dmaQueueNotEmpty(&(desc->q))); + return dmaQueueNotEmpty(&(desc->q)); break; // Set debug level case DMA_Set_Debug: dev->debug = arg; dev_info(dev->device,"debug set to %u.\n",(uint32_t)arg); - return(0); + return 0; break; // Attempt to reserve destination case DMA_Set_Mask: memset(newMask,0,DMA_MASK_SIZE); ((uint32_t *)newMask)[0] = arg; - return(Dma_SetMaskBytes(dev,desc,newMask)); + return Dma_SetMaskBytes(dev,desc,newMask); break; // Attempt to reserve destination case DMA_Set_MaskBytes: - if ( copy_from_user(newMask,(void *)arg,DMA_MASK_SIZE) ) return(-1); - return(Dma_SetMaskBytes(dev,desc,newMask)); + if ( copy_from_user(newMask,(void *)arg,DMA_MASK_SIZE) ) return -1; + return Dma_SetMaskBytes(dev,desc,newMask); break; // Return buffer index case DMA_Ret_Index: cnt = (cmd >> 16) & 0xFFFF; - if ( cnt == 0 ) return(0); + if ( cnt == 0 ) return 0; indexes = kzalloc(cnt * sizeof(uint32_t),GFP_KERNEL); - if (copy_from_user(indexes,(void *)arg,(cnt * sizeof(uint32_t)))) return(-1); + if (copy_from_user(indexes,(void *)arg,(cnt * sizeof(uint32_t)))) return -1; buffList = (struct DmaBuffer **)kzalloc(cnt * sizeof(struct DmaBuffer *),GFP_KERNEL); bCnt = 0; @@ -996,7 +996,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { else { dev_warn(dev->device,"Command: Invalid index posted: %i.\n", indexes[x]); kfree(indexes); - return(-1); + return -1; } } @@ -1005,7 +1005,7 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { kfree(buffList); kfree(indexes); - return(0); + return 0; break; // Request a write buffer index @@ -1015,37 +1015,37 @@ ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg) { buff = dmaQueuePop(&(dev->tq)); // No buffers are available - if ( buff == NULL ) return(-1); + if ( buff == NULL ) return -1; else { buff->userHas = desc; if ( dev->debug > 0 ) dev_info(dev->device,"Command: Returning buffer %i to user\n",buff->index); - return(buff->index); + return buff->index; } break; // Get API Version case DMA_Get_Version: - return(DMA_VERSION); + return DMA_VERSION; break; // Register write case DMA_Write_Register: - return(Dma_WriteRegister(dev,arg)); + return Dma_WriteRegister(dev,arg); break; // Register read case DMA_Read_Register: - return(Dma_ReadRegister(dev,arg)); + return Dma_ReadRegister(dev,arg); break; // All other commands handled by card specific functions default: - return(dev->hwFunc->command(dev,cmd,arg)); + return dev->hwFunc->command(dev,cmd,arg); break; } - return(0); + return 0; } /** @@ -1430,7 +1430,7 @@ int Dma_SetMaskBytes(struct DmaDevice *dev, struct DmaDesc *desc, uint8_t *mask) // Ensure the function is called only once static const uint8_t zero[DMA_MASK_SIZE] = {0}; - if (memcmp(desc->destMask, zero, DMA_MASK_SIZE)) return (-1); + if (memcmp(desc->destMask, zero, DMA_MASK_SIZE)) return -1; // Prevent data reception while adjusting the mask spin_lock_irqsave(&dev->maskLock, iflags); @@ -1446,7 +1446,7 @@ int Dma_SetMaskBytes(struct DmaDevice *dev, struct DmaDesc *desc, uint8_t *mask) spin_unlock_irqrestore(&dev->maskLock, iflags); if (dev->debug > 0) dev_info(dev->device, "Dma_SetMask: Dest %i already mapped\n", idx); - return (-1); + return -1; } } } @@ -1469,7 +1469,7 @@ int Dma_SetMaskBytes(struct DmaDevice *dev, struct DmaDesc *desc, uint8_t *mask) // Restore interrupts spin_unlock_irqrestore(&dev->maskLock, iflags); - return (0); + return 0; } /** diff --git a/common/driver/gpu_async.c b/common/driver/gpu_async.c index cfbad73..722d7f8 100755 --- a/common/driver/gpu_async.c +++ b/common/driver/gpu_async.c @@ -111,7 +111,7 @@ int32_t Gpu_AddNvidia(struct DmaDevice *dev, uint64_t arg) { // Copy data from user space if ((ret = copy_from_user(&dat, (void *)arg, sizeof(struct GpuNvidiaData)))) { dev_warn(dev->device, "Gpu_AddNvidia: copy_from_user failed. ret=%i, user=%p kern=%p\n", ret, (void *)arg, &dat); - return (-1); + return -1; } if (!dat.size) return -EINVAL; @@ -176,7 +176,7 @@ int32_t Gpu_AddNvidia(struct DmaDevice *dev, uint64_t arg) { } } else { dev_warn(dev->device,"Gpu_AddNvidia: failed to pin memory with address=0x%llx. ret=%i\n", dat.address,ret); - return(-1); + return -1; } x = 0; @@ -192,7 +192,7 @@ int32_t Gpu_AddNvidia(struct DmaDevice *dev, uint64_t arg) { } writel(x,data->base+0x008); - return(0); + return 0; } /**