Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b88e75bb authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: pcmmio: remove unneeded checks on detach



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: default avatarIan Abbott <abbotti@mev.co.uk>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aac6b82e
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1156,12 +1156,13 @@ static void pcmmio_detach(struct comedi_device *dev)
	struct pcmmio_private *devpriv = dev->private;
	int i;

	if (devpriv) {
		for (i = 0; i < MAX_ASICS; ++i) {
		if (devpriv && devpriv->asics[i].irq)
			if (devpriv->asics[i].irq)
				free_irq(devpriv->asics[i].irq, dev);
		}
	if (devpriv && devpriv->sprivs)
		kfree(devpriv->sprivs);
	}
	comedi_legacy_detach(dev);
}