The patch adds checks for the return values of dma_set_mask and ioremap. Previously, the function did not handle potential failures of these calls, which could lead to improper device initialization and unpredictable behavior. Although the error addressed by this patch may not occur in the current environment, I still suggest implementing these error handling routines if the function is not highly time-sensitive. As the environment evolves or the code gets reused in different contexts, there's a possibility that these errors might occur. Addressing them now can prevent potential debugging efforts in the future, which could be quite resource-intensive. Signed-off-by: Haoran Liu <liuhaoran14@xxxxxxx> --- drivers/scsi/sni_53c710.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c index 678651b9b4dd..41414d0c64f8 100644 --- a/drivers/scsi/sni_53c710.c +++ b/drivers/scsi/sni_53c710.c @@ -69,8 +69,19 @@ static int snirm710_probe(struct platform_device *dev) return -ENOMEM; hostdata->dev = &dev->dev; - dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); + rc = dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); + if (rc) { + printk(KERN_ERR "snirm710: dma_set_mask failed!\n"); + goto out_kfree; + } + hostdata->base = ioremap(base, 0x100); + if (!hostdata->base) { + printk(KERN_ERR "snirm710: ioremap failed!\n"); + rc = -ENOMEM; + goto out_kfree; + } + hostdata->differential = 0; hostdata->clock = SNIRM710_CLOCK; -- 2.17.1