Commit d485eb83 authored by Moore, Eric Dean's avatar Moore, Eric Dean Committed by James Bottomley

[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: default avatarEric Moore <Eric.Moore@lsil.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 3fadc59d
...@@ -1837,15 +1837,10 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) ...@@ -1837,15 +1837,10 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
ioc->alloc_total -= sz; ioc->alloc_total -= sz;
} }
if (ioc->spi_data.nvram != NULL) {
kfree(ioc->spi_data.nvram); kfree(ioc->spi_data.nvram);
ioc->spi_data.nvram = NULL;
}
if (ioc->spi_data.pIocPg3 != NULL) {
kfree(ioc->spi_data.pIocPg3); kfree(ioc->spi_data.pIocPg3);
ioc->spi_data.nvram = NULL;
ioc->spi_data.pIocPg3 = NULL; ioc->spi_data.pIocPg3 = NULL;
}
if (ioc->spi_data.pIocPg4 != NULL) { if (ioc->spi_data.pIocPg4 != NULL) {
sz = ioc->spi_data.IocPg4Sz; sz = ioc->spi_data.IocPg4Sz;
...@@ -1862,10 +1857,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) ...@@ -1862,10 +1857,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
ioc->ReqToChain = NULL; ioc->ReqToChain = NULL;
} }
if (ioc->ChainToChain != NULL) {
kfree(ioc->ChainToChain); kfree(ioc->ChainToChain);
ioc->ChainToChain = NULL; ioc->ChainToChain = NULL;
}
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -4403,10 +4396,8 @@ mpt_read_ioc_pg_3(MPT_ADAPTER *ioc) ...@@ -4403,10 +4396,8 @@ mpt_read_ioc_pg_3(MPT_ADAPTER *ioc)
/* Free the old page /* Free the old page
*/ */
if (ioc->spi_data.pIocPg3) {
kfree(ioc->spi_data.pIocPg3); kfree(ioc->spi_data.pIocPg3);
ioc->spi_data.pIocPg3 = NULL; ioc->spi_data.pIocPg3 = NULL;
}
/* There is at least one physical disk. /* There is at least one physical disk.
* Read and save IOC Page 3 * Read and save IOC Page 3
......
...@@ -99,14 +99,14 @@ struct buflist { ...@@ -99,14 +99,14 @@ struct buflist {
* arg contents specific to function. * arg contents specific to function.
*/ */
static int mptctl_fw_download(unsigned long arg); static int mptctl_fw_download(unsigned long arg);
static int mptctl_getiocinfo (unsigned long arg, unsigned int cmd); static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd);
static int mptctl_gettargetinfo (unsigned long arg); static int mptctl_gettargetinfo(unsigned long arg);
static int mptctl_readtest (unsigned long arg); static int mptctl_readtest(unsigned long arg);
static int mptctl_mpt_command (unsigned long arg); static int mptctl_mpt_command(unsigned long arg);
static int mptctl_eventquery (unsigned long arg); static int mptctl_eventquery(unsigned long arg);
static int mptctl_eventenable (unsigned long arg); static int mptctl_eventenable(unsigned long arg);
static int mptctl_eventreport (unsigned long arg); static int mptctl_eventreport(unsigned long arg);
static int mptctl_replace_fw (unsigned long arg); static int mptctl_replace_fw(unsigned long arg);
static int mptctl_do_reset(unsigned long arg); static int mptctl_do_reset(unsigned long arg);
static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); 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,11 +121,11 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg);
/* /*
* Private function calls. * Private function calls.
*/ */
static int mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr); static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr);
static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen);
static MptSge_t *kbuf_alloc_2_sgl( int bytes, u32 dir, int sge_offset, int *frags, static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags,
struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc);
static void kfree_sgl( MptSge_t *sgl, dma_addr_t sgl_dma, static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma,
struct buflist *buflist, MPT_ADAPTER *ioc); struct buflist *buflist, MPT_ADAPTER *ioc);
static void mptctl_timeout_expired (MPT_IOCTL *ioctl); static void mptctl_timeout_expired (MPT_IOCTL *ioctl);
static int mptctl_bus_reset(MPT_IOCTL *ioctl); static int mptctl_bus_reset(MPT_IOCTL *ioctl);
......
...@@ -538,8 +538,8 @@ mpt_lan_close(struct net_device *dev) ...@@ -538,8 +538,8 @@ mpt_lan_close(struct net_device *dev)
} }
} }
kfree (priv->RcvCtl); kfree(priv->RcvCtl);
kfree (priv->mpt_rxfidx); kfree(priv->mpt_rxfidx);
for (i = 0; i < priv->tx_max_out; i++) { for (i = 0; i < priv->tx_max_out; i++) {
if (priv->SendCtl[i].skb != NULL) { if (priv->SendCtl[i].skb != NULL) {
......
...@@ -998,19 +998,16 @@ mptscsih_remove(struct pci_dev *pdev) ...@@ -998,19 +998,16 @@ mptscsih_remove(struct pci_dev *pdev)
hd->ScsiLookup = NULL; hd->ScsiLookup = NULL;
} }
if (hd->Targets != NULL) {
/* /*
* Free pointer array. * Free pointer array.
*/ */
kfree(hd->Targets); kfree(hd->Targets);
hd->Targets = NULL; hd->Targets = NULL;
}
dprintk((MYIOC_s_INFO_FMT dprintk((MYIOC_s_INFO_FMT
"Free'd ScsiLookup (%d) memory\n", "Free'd ScsiLookup (%d) memory\n",
hd->ioc->name, sz1)); hd->ioc->name, sz1));
if (hd->info_kbuf != NULL)
kfree(hd->info_kbuf); kfree(hd->info_kbuf);
/* NULL the Scsi_Host pointer /* NULL the Scsi_Host pointer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment