提交 f25bd6bf 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

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: NDan Carpenter <error27@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 c5da2090
...@@ -719,8 +719,7 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) ...@@ -719,8 +719,7 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link)
((struct local_info_t *)link->priv)->stop = 1; ((struct local_info_t *)link->priv)->stop = 1;
das16cs_pcmcia_release(link); das16cs_pcmcia_release(link);
/* This points to the parent struct local_info_t struct */ /* This points to the parent struct local_info_t struct */
if (link->priv) kfree(link->priv);
kfree(link->priv);
} /* das16cs_pcmcia_detach */ } /* das16cs_pcmcia_detach */
......
...@@ -206,8 +206,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) ...@@ -206,8 +206,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *link)
das08_pcmcia_release(link); das08_pcmcia_release(link);
/* This points to the parent struct local_info_t struct */ /* This points to the parent struct local_info_t struct */
if (link->priv) kfree(link->priv);
kfree(link->priv);
} /* das08_pcmcia_detach */ } /* das08_pcmcia_detach */
......
...@@ -537,8 +537,7 @@ static void dio700_cs_detach(struct pcmcia_device *link) ...@@ -537,8 +537,7 @@ static void dio700_cs_detach(struct pcmcia_device *link)
dio700_release(link); dio700_release(link);
/* This points to the parent struct local_info_t struct */ /* This points to the parent struct local_info_t struct */
if (link->priv) kfree(link->priv);
kfree(link->priv);
} /* dio700_cs_detach */ } /* dio700_cs_detach */
......
...@@ -289,8 +289,7 @@ static void dio24_cs_detach(struct pcmcia_device *link) ...@@ -289,8 +289,7 @@ static void dio24_cs_detach(struct pcmcia_device *link)
dio24_release(link); dio24_release(link);
/* This points to the parent local_info_t struct */ /* This points to the parent local_info_t struct */
if (link->priv) kfree(link->priv);
kfree(link->priv);
} /* dio24_cs_detach */ } /* dio24_cs_detach */
......
...@@ -1076,8 +1076,7 @@ static void daqp_cs_detach(struct pcmcia_device *link) ...@@ -1076,8 +1076,7 @@ static void daqp_cs_detach(struct pcmcia_device *link)
/* Unlink device structure, and free it */ /* Unlink device structure, and free it */
dev_table[dev->table_index] = NULL; dev_table[dev->table_index] = NULL;
if (dev) kfree(dev);
kfree(dev);
} /* daqp_cs_detach */ } /* daqp_cs_detach */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册