mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: driverdev-devel@linuxdriverproject.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ian Abbott <abbotti@mev.co.uk>,
	H Hartley Sweeten <hartleys@visionengravers.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] staging: comedi: amplc_dio200_pci: no need to test board pointer in dio200_pci_detach()
Date: Fri, 25 Jul 2014 18:07:09 +0100	[thread overview]
Message-ID: <1406308029-15712-4-git-send-email-abbotti@mev.co.uk> (raw)
In-Reply-To: <1406308029-15712-1-git-send-email-abbotti@mev.co.uk>

`dio200_pci_detach()` doesn't need to check if the pointer to constant
board data (`thisboard`) and the pointer to private per-device data
(`devpriv`) are valid before calling `amplc_dio200_common_detach()`.  It
has no further need to check `thisboard` so remove the variable
altogether.  Move the test of `devpriv` to the first point it is needs
to be valid.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/amplc_dio200_pci.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
index 3cec0e0..1954c1b 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
@@ -414,13 +414,10 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
 
 static void dio200_pci_detach(struct comedi_device *dev)
 {
-	const struct dio200_board *thisboard = comedi_board(dev);
 	struct dio200_private *devpriv = dev->private;
 
-	if (!thisboard || !devpriv)
-		return;
 	amplc_dio200_common_detach(dev);
-	if (devpriv->io.regtype == mmio_regtype)
+	if (devpriv && devpriv->io.regtype == mmio_regtype)
 		iounmap(devpriv->io.u.membase);
 	comedi_pci_disable(dev);
 }
-- 
2.0.0


  parent reply	other threads:[~2014-07-25 17:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 17:07 [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups Ian Abbott
2014-07-25 17:07 ` [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq() Ian Abbott
2014-07-25 18:23   ` Hartley Sweeten
2014-07-27 18:45     ` Greg Kroah-Hartman
2014-07-28  9:27       ` Ian Abbott
2014-07-28 16:35       ` Hartley Sweeten
2014-07-25 17:07 ` [PATCH 2/3] staging: comedi: amplc_dio200_common: remove some tests from amplc_dio200_common_detach() Ian Abbott
2014-07-25 17:07 ` Ian Abbott [this message]
2014-07-25 18:14 ` [PATCH 0/3] staging: comedi: amplc_dio200 detach cleanups Hartley Sweeten

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406308029-15712-4-git-send-email-abbotti@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hartleys@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®