diff options
author | Moore, Eric Dean <Eric.Moore@lsil.com> | 2005-05-11 19:37:26 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-05-20 16:47:54 -0400 |
commit | d485eb830576eef911727b1347402e9a708998a2 (patch) | |
tree | 497abb8f1cf8f82969647e0844da6752042f220a /drivers/message/fusion | |
parent | 3fadc59d603caf70e7a5295158e4f6eb06dffb8f (diff) |
[SCSI] fusion-kfree-cleanup
This patch is originally From: Jesper Juhl <juhl-lkml@dif.dk>
This patch gets rid of redundant NULL checks prior to calling kfree() in
drivers/message/* There are also a few small whitespace changes in there.
Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 25 | ||||
-rw-r--r-- | drivers/message/fusion/mptctl.c | 22 | ||||
-rw-r--r-- | drivers/message/fusion/mptlan.c | 4 | ||||
-rw-r--r-- | drivers/message/fusion/mptscsih.c | 15 |
4 files changed, 27 insertions, 39 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 673cdd955eed..8b623278ccd2 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -1837,15 +1837,10 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) | |||
1837 | ioc->alloc_total -= sz; | 1837 | ioc->alloc_total -= sz; |
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | if (ioc->spi_data.nvram != NULL) { | 1840 | kfree(ioc->spi_data.nvram); |
1841 | kfree(ioc->spi_data.nvram); | 1841 | kfree(ioc->spi_data.pIocPg3); |
1842 | ioc->spi_data.nvram = NULL; | 1842 | ioc->spi_data.nvram = NULL; |
1843 | } | 1843 | ioc->spi_data.pIocPg3 = NULL; |
1844 | |||
1845 | if (ioc->spi_data.pIocPg3 != NULL) { | ||
1846 | kfree(ioc->spi_data.pIocPg3); | ||
1847 | ioc->spi_data.pIocPg3 = NULL; | ||
1848 | } | ||
1849 | 1844 | ||
1850 | if (ioc->spi_data.pIocPg4 != NULL) { | 1845 | if (ioc->spi_data.pIocPg4 != NULL) { |
1851 | sz = ioc->spi_data.IocPg4Sz; | 1846 | sz = ioc->spi_data.IocPg4Sz; |
@@ -1862,10 +1857,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) | |||
1862 | ioc->ReqToChain = NULL; | 1857 | ioc->ReqToChain = NULL; |
1863 | } | 1858 | } |
1864 | 1859 | ||
1865 | if (ioc->ChainToChain != NULL) { | 1860 | kfree(ioc->ChainToChain); |
1866 | kfree(ioc->ChainToChain); | 1861 | ioc->ChainToChain = NULL; |
1867 | ioc->ChainToChain = NULL; | ||
1868 | } | ||
1869 | } | 1862 | } |
1870 | 1863 | ||
1871 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1864 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -4403,10 +4396,8 @@ mpt_read_ioc_pg_3(MPT_ADAPTER *ioc) | |||
4403 | 4396 | ||
4404 | /* Free the old page | 4397 | /* Free the old page |
4405 | */ | 4398 | */ |
4406 | if (ioc->spi_data.pIocPg3) { | 4399 | kfree(ioc->spi_data.pIocPg3); |
4407 | kfree(ioc->spi_data.pIocPg3); | 4400 | ioc->spi_data.pIocPg3 = NULL; |
4408 | ioc->spi_data.pIocPg3 = NULL; | ||
4409 | } | ||
4410 | 4401 | ||
4411 | /* There is at least one physical disk. | 4402 | /* There is at least one physical disk. |
4412 | * Read and save IOC Page 3 | 4403 | * Read and save IOC Page 3 |
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 7f9a87757df3..05ea5944c487 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -99,14 +99,14 @@ struct buflist { | |||
99 | * arg contents specific to function. | 99 | * arg contents specific to function. |
100 | */ | 100 | */ |
101 | static int mptctl_fw_download(unsigned long arg); | 101 | static int mptctl_fw_download(unsigned long arg); |
102 | static int mptctl_getiocinfo (unsigned long arg, unsigned int cmd); | 102 | static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd); |
103 | static int mptctl_gettargetinfo (unsigned long arg); | 103 | static int mptctl_gettargetinfo(unsigned long arg); |
104 | static int mptctl_readtest (unsigned long arg); | 104 | static int mptctl_readtest(unsigned long arg); |
105 | static int mptctl_mpt_command (unsigned long arg); | 105 | static int mptctl_mpt_command(unsigned long arg); |
106 | static int mptctl_eventquery (unsigned long arg); | 106 | static int mptctl_eventquery(unsigned long arg); |
107 | static int mptctl_eventenable (unsigned long arg); | 107 | static int mptctl_eventenable(unsigned long arg); |
108 | static int mptctl_eventreport (unsigned long arg); | 108 | static int mptctl_eventreport(unsigned long arg); |
109 | static int mptctl_replace_fw (unsigned long arg); | 109 | static int mptctl_replace_fw(unsigned long arg); |
110 | 110 | ||
111 | static int mptctl_do_reset(unsigned long arg); | 111 | static int mptctl_do_reset(unsigned long arg); |
112 | static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); | 112 | static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); |
@@ -121,11 +121,11 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg); | |||
121 | /* | 121 | /* |
122 | * Private function calls. | 122 | * Private function calls. |
123 | */ | 123 | */ |
124 | static int mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr); | 124 | static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr); |
125 | static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); | 125 | static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); |
126 | static MptSge_t *kbuf_alloc_2_sgl( int bytes, u32 dir, int sge_offset, int *frags, | 126 | static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags, |
127 | struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); | 127 | struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); |
128 | static void kfree_sgl( MptSge_t *sgl, dma_addr_t sgl_dma, | 128 | static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, |
129 | struct buflist *buflist, MPT_ADAPTER *ioc); | 129 | struct buflist *buflist, MPT_ADAPTER *ioc); |
130 | static void mptctl_timeout_expired (MPT_IOCTL *ioctl); | 130 | static void mptctl_timeout_expired (MPT_IOCTL *ioctl); |
131 | static int mptctl_bus_reset(MPT_IOCTL *ioctl); | 131 | static int mptctl_bus_reset(MPT_IOCTL *ioctl); |
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c index 7defac72f256..52794be5a95c 100644 --- a/drivers/message/fusion/mptlan.c +++ b/drivers/message/fusion/mptlan.c | |||
@@ -538,8 +538,8 @@ mpt_lan_close(struct net_device *dev) | |||
538 | } | 538 | } |
539 | } | 539 | } |
540 | 540 | ||
541 | kfree (priv->RcvCtl); | 541 | kfree(priv->RcvCtl); |
542 | kfree (priv->mpt_rxfidx); | 542 | kfree(priv->mpt_rxfidx); |
543 | 543 | ||
544 | for (i = 0; i < priv->tx_max_out; i++) { | 544 | for (i = 0; i < priv->tx_max_out; i++) { |
545 | if (priv->SendCtl[i].skb != NULL) { | 545 | if (priv->SendCtl[i].skb != NULL) { |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index cf058a399dab..c8492034cfe7 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -998,20 +998,17 @@ mptscsih_remove(struct pci_dev *pdev) | |||
998 | hd->ScsiLookup = NULL; | 998 | hd->ScsiLookup = NULL; |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | if (hd->Targets != NULL) { | 1001 | /* |
1002 | /* | 1002 | * Free pointer array. |
1003 | * Free pointer array. | 1003 | */ |
1004 | */ | 1004 | kfree(hd->Targets); |
1005 | kfree(hd->Targets); | 1005 | hd->Targets = NULL; |
1006 | hd->Targets = NULL; | ||
1007 | } | ||
1008 | 1006 | ||
1009 | dprintk((MYIOC_s_INFO_FMT | 1007 | dprintk((MYIOC_s_INFO_FMT |
1010 | "Free'd ScsiLookup (%d) memory\n", | 1008 | "Free'd ScsiLookup (%d) memory\n", |
1011 | hd->ioc->name, sz1)); | 1009 | hd->ioc->name, sz1)); |
1012 | 1010 | ||
1013 | if (hd->info_kbuf != NULL) | 1011 | kfree(hd->info_kbuf); |
1014 | kfree(hd->info_kbuf); | ||
1015 | 1012 | ||
1016 | /* NULL the Scsi_Host pointer | 1013 | /* NULL the Scsi_Host pointer |
1017 | */ | 1014 | */ |