[PATCH-3.10.y-3.11.y] staging: comedi: pcmmio: remove unneeded checks on detach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



follow 	b88e75bb6576d99e0ba4f6edc978293d1ff9c01b

As pointed out by Dan carpenter for the similar pcmuio driver, there is
no need to check the pointer passed to `kfree()`, so remove that check
from `pcmmio_detach()`.

Also, check the `devpriv` (`dev->private`) pointer once, outside the
`for` loop.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
Applies to 3.10.y and 3.11.y only.
Not needed for other kernels.
---
 drivers/staging/comedi/drivers/pcmmio.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c
index 9f76b1f..9e93791 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -1197,12 +1197,13 @@ static void pcmmio_detach(struct comedi_device *dev)
 	struct pcmmio_private *devpriv = dev->private;
 	int i;
 
-	for (i = 0; i < MAX_ASICS; ++i) {
-		if (devpriv && devpriv->asics[i].irq)
-			free_irq(devpriv->asics[i].irq, dev);
-	}
-	if (devpriv && devpriv->sprivs)
+	if (devpriv) {
+		for (i = 0; i < MAX_ASICS; ++i) {
+			if (devpriv->asics[i].irq)
+				free_irq(devpriv->asics[i].irq, dev);
+		}
 		kfree(devpriv->sprivs);
+	}
 	comedi_legacy_detach(dev);
 }
 
-- 
1.8.4.4

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]