diff options
author | Dan Carpenter <error27@gmail.com> | 2010-05-22 22:42:38 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-06-17 13:36:33 -0700 |
commit | f25bd6bfdf9bccd8164c151b027f9c14ec07960b (patch) | |
tree | f3574b5fb8f244845b0dd8fdfaea3ca1ba36b9bd /drivers/staging | |
parent | c5da20905c8ce21a73a9b443e5d7ef0dc623cff0 (diff) | |
download | op-kernel-dev-f25bd6bfdf9bccd8164c151b027f9c14ec07960b.zip op-kernel-dev-f25bd6bfdf9bccd8164c151b027f9c14ec07960b.tar.gz |
Staging: comedi: cleanup: remove unneeded null checks
These checks are obviously pointless because kfree() can handle null
dereferences.
But really the main problem is that if the pointers were null that would
cause problems on the ealier lines. The dereferences would cause an
oops and the _release() functions use ->priv to determine which IRQ to
free. I looked into it and quite a few of the detach functions assume
link->priv is non-null. It seems like we can remove these checks.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/comedi/drivers/cb_das16_cs.c | 3 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/das08_cs.c | 3 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_daq_700.c | 3 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_daq_dio24.c | 3 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/quatech_daqp_cs.c | 3 |
5 files changed, 5 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index cfeb11f..d8d4ed6 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -719,8 +719,7 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) ((struct local_info_t *)link->priv)->stop = 1; das16cs_pcmcia_release(link); /* This points to the parent struct local_info_t struct */ - if (link->priv) - kfree(link->priv); + kfree(link->priv); } /* das16cs_pcmcia_detach */ diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 8761a6d..fb561ab 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -206,8 +206,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) das08_pcmcia_release(link); /* This points to the parent struct local_info_t struct */ - if (link->priv) - kfree(link->priv); + kfree(link->priv); } /* das08_pcmcia_detach */ diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 6ec77bf..701abd9 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -537,8 +537,7 @@ static void dio700_cs_detach(struct pcmcia_device *link) dio700_release(link); /* This points to the parent struct local_info_t struct */ - if (link->priv) - kfree(link->priv); + kfree(link->priv); } /* dio700_cs_detach */ diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index e4865b1..0b65f24 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -289,8 +289,7 @@ static void dio24_cs_detach(struct pcmcia_device *link) dio24_release(link); /* This points to the parent local_info_t struct */ - if (link->priv) - kfree(link->priv); + kfree(link->priv); } /* dio24_cs_detach */ diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index a91db6c..78eb254 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -1076,8 +1076,7 @@ static void daqp_cs_detach(struct pcmcia_device *link) /* Unlink device structure, and free it */ dev_table[dev->table_index] = NULL; - if (dev) - kfree(dev); + kfree(dev); } /* daqp_cs_detach */ |