From 650931bb73edf1ad97f376d8578d02b7c0b7cc5c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 09:57:33 +0100
Subject: [PATCH 1/8] drivers/staging: remove unnecessary if-before-kfree tests


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 drivers/staging/comedi/drivers/cb_das16_cs.c       |    3 +--
 drivers/staging/comedi/drivers/das08_cs.c          |    3 +--
 drivers/staging/comedi/drivers/das16.c             |    6 ++----
 drivers/staging/comedi/drivers/das1800.c           |    6 ++----
 drivers/staging/comedi/drivers/ni_at_a2150.c       |    3 +--
 drivers/staging/comedi/drivers/ni_daq_700.c        |    3 +--
 drivers/staging/comedi/drivers/ni_daq_dio24.c      |    3 +--
 drivers/staging/comedi/drivers/ni_labpc.c          |    3 +--
 drivers/staging/comedi/drivers/quatech_daqp_cs.c   |    3 +--
 drivers/staging/comedi/drivers/serial2002.c        |   16 ++++------------
 drivers/staging/crystalhd/crystalhd_lnx.c          |    3 +--
 drivers/staging/cx25821/cx25821-audio-upstream.c   |    3 +--
 .../staging/cx25821/cx25821-video-upstream-ch2.c   |    3 +--
 drivers/staging/cx25821/cx25821-video-upstream.c   |    3 +--
 drivers/staging/dream/camera/msm_vfe7x.c           |    3 +--
 drivers/staging/go7007/go7007-usb.c                |    6 ++----
 drivers/staging/pohmelfs/config.c                  |    6 ++----
 drivers/staging/rt2860/common/spectrum.c           |    6 ++----
 drivers/staging/rt2860/rt_linux.c                  |    6 ++----
 .../rtl8187se/ieee80211/ieee80211_softmac.c        |    3 +--
 drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c |    1 -
 drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c  |    1 -
 drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c |    1 -
 drivers/staging/rtl8192u/ieee80211/cipher.c        |    3 +--
 drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c  |    1 -
 drivers/staging/rtl8192u/r8192U_core.c             |    8 ++------
 drivers/staging/serqt_usb2/serqt_usb2.c            |    3 +--
 drivers/staging/usbip/stub_main.c                  |    6 ++----
 drivers/staging/vme/bridges/vme_ca91cx42.c         |    3 +--
 drivers/staging/vme/bridges/vme_tsi148.c           |    3 +--
 drivers/staging/vt6655/device_main.c               |    3 +--
 drivers/staging/vt6655/hostap.c                    |    3 +--
 drivers/staging/vt6655/wpactl.c                    |    3 +--
 drivers/staging/vt6656/firmware.c                  |    6 ++----
 drivers/staging/vt6656/hostap.c                    |    3 +--
 drivers/staging/vt6656/main_usb.c                  |   12 ++++--------
 drivers/staging/vt6656/wpactl.c                    |    3 +--
 drivers/staging/winbond/wb35reg.c                  |    3 +--
 drivers/staging/wlan-ng/prism2fw.c                 |    3 +--
 39 files changed, 50 insertions(+), 110 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c
index 5632991..f2355aa 100644
--- a/drivers/staging/comedi/drivers/cb_das16_cs.c
+++ b/drivers/staging/comedi/drivers/cb_das16_cs.c
@@ -725,8 +725,7 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link)
 		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 9164ce1..a6e17a8 100644
--- a/drivers/staging/comedi/drivers/das08_cs.c
+++ b/drivers/staging/comedi/drivers/das08_cs.c
@@ -213,8 +213,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *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/das16.c b/drivers/staging/comedi/drivers/das16.c
index f2aadda..9506d27 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -1674,10 +1674,8 @@ static int das16_detach(struct comedi_device *dev)
 		}
 		if (devpriv->dma_chan)
 			free_dma(devpriv->dma_chan);
-		if (devpriv->user_ai_range_table)
-			kfree(devpriv->user_ai_range_table);
-		if (devpriv->user_ao_range_table)
-			kfree(devpriv->user_ao_range_table);
+		kfree(devpriv->user_ai_range_table);
+		kfree(devpriv->user_ao_range_table);
 	}

 	if (dev->irq)
diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 3c3e045..d91c2d9 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -797,10 +797,8 @@ static int das1800_detach(struct comedi_device *dev)
 			free_dma(devpriv->dma0);
 		if (devpriv->dma1)
 			free_dma(devpriv->dma1);
-		if (devpriv->ai_buf0)
-			kfree(devpriv->ai_buf0);
-		if (devpriv->ai_buf1)
-			kfree(devpriv->ai_buf1);
+		kfree(devpriv->ai_buf0);
+		kfree(devpriv->ai_buf1);
 	}

 	printk("comedi%d: %s: remove\n", dev->minor,
diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
index 9bff34c..5a636a1 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -468,8 +468,7 @@ static int a2150_detach(struct comedi_device *dev)
 	if (devpriv) {
 		if (devpriv->dma)
 			free_dma(devpriv->dma);
-		if (devpriv->dma_buffer)
-			kfree(devpriv->dma_buffer);
+		kfree(devpriv->dma_buffer);
 	}

 	return 0;
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c
index 7ea6453..267ffab 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -545,8 +545,7 @@ static void dio700_cs_detach(struct pcmcia_device *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 ddc312b..fc4a96b 100644
--- a/drivers/staging/comedi/drivers/ni_daq_dio24.c
+++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c
@@ -296,8 +296,7 @@ static void dio24_cs_detach(struct pcmcia_device *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/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 558e525..a7e0a98 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -791,8 +791,7 @@ int labpc_common_detach(struct comedi_device *dev)
 		subdev_8255_cleanup(dev, dev->subdevices + 2);

 	/* only free stuff if it has been allocated by _attach */
-	if (devpriv->dma_buffer)
-		kfree(devpriv->dma_buffer);
+	kfree(devpriv->dma_buffer);
 	if (devpriv->dma_chan)
 		free_dma(devpriv->dma_chan);
 	if (dev->irq)
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index 3325f24..56af1d8 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -1081,8 +1081,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 */

diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index 0792617..95f975c 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -632,15 +632,11 @@ static void serial_2002_open(struct comedi_device *dev)
 				s = &dev->subdevices[i];
 				s->n_chan = chan;
 				s->maxdata = 0;
-				if (s->maxdata_list) {
-					kfree(s->maxdata_list);
-				}
+				kfree(s->maxdata_list);
 				s->maxdata_list = maxdata_list =
 				    kmalloc(sizeof(unsigned int) * s->n_chan,
 					    GFP_KERNEL);
-				if (s->range_table_list) {
-					kfree(s->range_table_list);
-				}
+				kfree(s->range_table_list);
 				if (range) {
 					s->range_table = 0;
 					s->range_table_list = range_table_list =
@@ -881,12 +877,8 @@ static int serial2002_detach(struct comedi_device *dev)
 	printk("comedi%d: serial2002: remove\n", dev->minor);
 	for (i = 0; i < 4; i++) {
 		s = &dev->subdevices[i];
-		if (s->maxdata_list) {
-			kfree(s->maxdata_list);
-		}
-		if (s->range_table_list) {
-			kfree(s->range_table_list);
-		}
+		kfree(s->maxdata_list);
+		kfree(s->range_table_list);
 	}
 	return 0;
 }
diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c
index 54bad65..54dff81 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -431,8 +431,7 @@ static void __devexit chd_dec_release_chdev(struct crystalhd_adp *adp)
 	/* Clear iodata pool.. */
 	do {
 		temp = chd_dec_alloc_iodata(adp, 0);
-		if (temp)
-			kfree(temp);
+		kfree(temp);
 	} while (temp);

 	crystalhd_delete_elem_pool(adp);
diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c
index 11c56bd..5d2f1bb 100644
--- a/drivers/staging/cx25821/cx25821-audio-upstream.c
+++ b/drivers/staging/cx25821/cx25821-audio-upstream.c
@@ -247,8 +247,7 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
 		dev->_irq_audio_queues = NULL;
 	}

-	if (dev->_audiofilename != NULL)
-		kfree(dev->_audiofilename);
+	kfree(dev->_audiofilename);
 }

 void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev)
diff --git a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c
index cc51618..2a9e230 100644
--- a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c
+++ b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c
@@ -235,8 +235,7 @@ void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev)
 		dev->_irq_queues_ch2 = NULL;
 	}

-	if (dev->_filename_ch2 != NULL)
-		kfree(dev->_filename_ch2);
+	kfree(dev->_filename_ch2);

 	tmp = cx_read(VID_CH_MODE_SEL);
 	cx_write(VID_CH_MODE_SEL, tmp & 0xFFFFFE00);
diff --git a/drivers/staging/cx25821/cx25821-video-upstream.c b/drivers/staging/cx25821/cx25821-video-upstream.c
index 6d48a1e..fdcc4b0 100644
--- a/drivers/staging/cx25821/cx25821-video-upstream.c
+++ b/drivers/staging/cx25821/cx25821-video-upstream.c
@@ -283,8 +283,7 @@ void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev)
 		dev->_irq_queues = NULL;
 	}

-	if (dev->_filename != NULL)
-		kfree(dev->_filename);
+	kfree(dev->_filename);

 	tmp = cx_read(VID_CH_MODE_SEL);
 	cx_write(VID_CH_MODE_SEL, tmp & 0xFFFFFE00);
diff --git a/drivers/staging/dream/camera/msm_vfe7x.c b/drivers/staging/dream/camera/msm_vfe7x.c
index 198656a..f3e93dd 100644
--- a/drivers/staging/dream/camera/msm_vfe7x.c
+++ b/drivers/staging/dream/camera/msm_vfe7x.c
@@ -680,8 +680,7 @@ config_send:
 				cmd_data, vfecmd->length);

 config_done:
-	if (cmd_data_alloc != NULL)
-		kfree(cmd_data_alloc);
+	kfree(cmd_data_alloc);

 config_failure:
 	kfree(scfg);
diff --git a/drivers/staging/go7007/go7007-usb.c b/drivers/staging/go7007/go7007-usb.c
index ee278f6..f0a5998 100644
--- a/drivers/staging/go7007/go7007-usb.c
+++ b/drivers/staging/go7007/go7007-usb.c
@@ -1248,15 +1248,13 @@ static void go7007_usb_disconnect(struct usb_interface *intf)
 		vurb = usb->video_urbs[i];
 		if (vurb) {
 			usb_kill_urb(vurb);
-			if (vurb->transfer_buffer)
-				kfree(vurb->transfer_buffer);
+			kfree(vurb->transfer_buffer);
 			usb_free_urb(vurb);
 		}
 		aurb = usb->audio_urbs[i];
 		if (aurb) {
 			usb_kill_urb(aurb);
-			if (aurb->transfer_buffer)
-				kfree(aurb->transfer_buffer);
+			kfree(aurb->transfer_buffer);
 			usb_free_urb(aurb);
 		}
 	}
diff --git a/drivers/staging/pohmelfs/config.c b/drivers/staging/pohmelfs/config.c
index eed0e55..3c7d107 100644
--- a/drivers/staging/pohmelfs/config.c
+++ b/drivers/staging/pohmelfs/config.c
@@ -608,11 +608,9 @@ void pohmelfs_config_exit(void)

 		list_del(&g->group_entry);

-		if (g->hash_string)
-			kfree(g->hash_string);
+		kfree(g->hash_string);

-		if (g->cipher_string)
-			kfree(g->cipher_string);
+		kfree(g->cipher_string);

 		kfree(g);
 	}
diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c
index 51e38d8..4684759 100644
--- a/drivers/staging/rt2860/common/spectrum.c
+++ b/drivers/staging/rt2860/common/spectrum.c
@@ -416,8 +416,7 @@ void MeasureReqTabExit(struct rt_rtmp_adapter *pAd)
 {
 	NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock);

-	if (pAd->CommonCfg.pMeasureReqTab)
-		kfree(pAd->CommonCfg.pMeasureReqTab);
+	kfree(pAd->CommonCfg.pMeasureReqTab);
 	pAd->CommonCfg.pMeasureReqTab = NULL;

 	return;
@@ -614,8 +613,7 @@ void TpcReqTabExit(struct rt_rtmp_adapter *pAd)
 {
 	NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock);

-	if (pAd->CommonCfg.pTpcReqTab)
-		kfree(pAd->CommonCfg.pTpcReqTab);
+	kfree(pAd->CommonCfg.pTpcReqTab);
 	pAd->CommonCfg.pTpcReqTab = NULL;

 	return;
diff --git a/drivers/staging/rt2860/rt_linux.c b/drivers/staging/rt2860/rt_linux.c
index fd9a207..daef503 100644
--- a/drivers/staging/rt2860/rt_linux.c
+++ b/drivers/staging/rt2860/rt_linux.c
@@ -242,8 +242,7 @@ void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd)

 	os_cookie = (struct os_cookie *)pAd->OS_Cookie;

-	if (pAd->BeaconBuf)
-		kfree(pAd->BeaconBuf);
+	kfree(pAd->BeaconBuf);

 	NdisFreeSpinLock(&pAd->MgmtRingLock);

@@ -265,8 +264,7 @@ void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd)
 	release_firmware(pAd->firmware);

 	vfree(pAd);		/* pci_free_consistent(os_cookie->pci_dev,sizeof(struct rt_rtmp_adapter),pAd,os_cookie->pAd_pa); */
-	if (os_cookie)
-		kfree(os_cookie);
+	kfree(os_cookie);
 }

 BOOLEAN OS_Need_Clone_Packet(void)
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
index be2d17f..7ebedd4 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -2601,8 +2601,7 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee)
 	cancel_delayed_work(&ieee->GPIOChangeRFWorkItem);

 	destroy_workqueue(ieee->wq);
-	if(NULL != ieee->pDot11dInfo)
-		kfree(ieee->pDot11dInfo);
+	kfree(ieee->pDot11dInfo);
 	up(&ieee->wx_sem);
 }

diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
index c5b80f9..0e9700c 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
@@ -737,7 +737,6 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
 		ieee->wpa_ie_len = len;
 	}
 	else{
-		if (ieee->wpa_ie)
 		kfree(ieee->wpa_ie);
 		ieee->wpa_ie = NULL;
 		ieee->wpa_ie_len = 0;
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
index de57967..ff24f4e 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
@@ -989,7 +989,6 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
 		ieee->wpa_ie_len = len;
 	}
 	else{
-		if (ieee->wpa_ie)
 		kfree(ieee->wpa_ie);
 		ieee->wpa_ie = NULL;
 		ieee->wpa_ie_len = 0;
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
index 727cc55..d9b17a2 100644
--- a/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c
@@ -777,7 +777,6 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
 		ieee->wpa_ie_len = len;
 	}
 	else{
-		if (ieee->wpa_ie)
 		kfree(ieee->wpa_ie);
 		ieee->wpa_ie = NULL;
 		ieee->wpa_ie_len = 0;
diff --git a/drivers/staging/rtl8192u/ieee80211/cipher.c b/drivers/staging/rtl8192u/ieee80211/cipher.c
index 0b9e8a4..69dcc31 100644
--- a/drivers/staging/rtl8192u/ieee80211/cipher.c
+++ b/drivers/staging/rtl8192u/ieee80211/cipher.c
@@ -294,6 +294,5 @@ out:

 void crypto_exit_cipher_ops(struct crypto_tfm *tfm)
 {
-	if (tfm->crt_cipher.cit_iv)
-		kfree(tfm->crt_cipher.cit_iv);
+	kfree(tfm->crt_cipher.cit_iv);
 }
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
index 750e94e..98131db 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
@@ -858,7 +858,6 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
 		ieee->wpa_ie_len = len;
 	}
 	else{
-		if (ieee->wpa_ie)
 		kfree(ieee->wpa_ie);
 		ieee->wpa_ie = NULL;
 		ieee->wpa_ie_len = 0;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 68ebb02..447ae77 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2260,12 +2260,8 @@ short rtl8192_usb_initendpoints(struct net_device *dev)


 destroy:
-	if (priv->pp_rxskb) {
-		kfree(priv->pp_rxskb);
-	}
-	if (priv->rx_urb) {
-		kfree(priv->rx_urb);
-	}
+	kfree(priv->pp_rxskb);
+	kfree(priv->rx_urb);

 	priv->pp_rxskb = NULL;
 	priv->rx_urb = NULL;
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c
index 44f2d4e..0a1d95d 100644
--- a/drivers/staging/serqt_usb2/serqt_usb2.c
+++ b/drivers/staging/serqt_usb2/serqt_usb2.c
@@ -1098,8 +1098,7 @@ static void qt_close(struct usb_serial_port *port)

 	if (qt_port->write_urb) {
 		/* if this urb had a transfer buffer already (old tx) free it */
-		if (qt_port->write_urb->transfer_buffer != NULL)
-			kfree(qt_port->write_urb->transfer_buffer);
+		kfree(qt_port->write_urb->transfer_buffer);
 		usb_free_urb(qt_port->write_urb);
 	}

diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c
index 6665cef..1d606bd 100644
--- a/drivers/staging/usbip/stub_main.c
+++ b/drivers/staging/usbip/stub_main.c
@@ -224,11 +224,9 @@ void stub_device_cleanup_urbs(struct stub_device *sdev)

 		kmem_cache_free(stub_priv_cache, priv);

-		if (urb->transfer_buffer != NULL)
-			kfree(urb->transfer_buffer);
+		kfree(urb->transfer_buffer);

-		if (urb->setup_packet != NULL)
-			kfree(urb->setup_packet);
+		kfree(urb->setup_packet);

 		usb_free_urb(urb);
 	}
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index b159ea5..a96a7c8 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -506,8 +506,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 	if (existing_size != 0) {
 		iounmap(image->kern_base);
 		image->kern_base = NULL;
-		if (image->bus_resource.name != NULL)
-			kfree(image->bus_resource.name);
+		kfree(image->bus_resource.name);
 		release_resource(&(image->bus_resource));
 		memset(&(image->bus_resource), 0, sizeof(struct resource));
 	}
diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c
index 783051f..0b07d78 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme/bridges/vme_tsi148.c
@@ -832,8 +832,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 	if (existing_size != 0) {
 		iounmap(image->kern_base);
 		image->kern_base = NULL;
-		if (image->bus_resource.name != NULL)
-			kfree(image->bus_resource.name);
+		kfree(image->bus_resource.name);
 		release_resource(&(image->bus_resource));
 		memset(&(image->bus_resource), 0, sizeof(struct resource));
 	}
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index e40a2e9..fa0b317 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -3056,8 +3056,7 @@ else {
 }

 error1:
-  if(buffer)
-  	 kfree(buffer);
+  kfree(buffer);

   if(filp_close(filp,NULL))
        printk("Config_FileOperation:close file fail\n");
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
index 58abf44..6216c4b 100644
--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
@@ -861,8 +861,7 @@ int hostap_ioctl(PSDevice pDevice, struct iw_point *p)
 	}

  out:
-	if (param != NULL)
-		kfree(param);
+	kfree(param);

 	return ret;
 }
diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c
index 574e0b0..70a99b8 100644
--- a/drivers/staging/vt6655/wpactl.c
+++ b/drivers/staging/vt6655/wpactl.c
@@ -983,8 +983,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
 	}

 out:
-	if (param != NULL)
-		kfree(param);
+	kfree(param);

 	return ret;
 }
diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c
index 585b6b1..36c1fd1 100644
--- a/drivers/staging/vt6656/firmware.c
+++ b/drivers/staging/vt6656/firmware.c
@@ -803,16 +803,14 @@ FIRMWAREbDownload(

             DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Download firmware...%d %zu\n", ii, sizeof(abyFirmware));
             if (NdisStatus != STATUS_SUCCESS) {
-                if (pBuffer)
-                    kfree(pBuffer);
+                kfree(pBuffer);
                 spin_lock_irq(&pDevice->lock);
                 return (FALSE);
             }
         }
     }

-    if (pBuffer)
-        kfree(pBuffer);
+    kfree(pBuffer);

     spin_lock_irq(&pDevice->lock);
     return (TRUE);
diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index 1078d61..99e1fa7 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -859,8 +859,7 @@ int hostap_ioctl(PSDevice pDevice, struct iw_point *p)
 	}

  out:
-	if (param != NULL)
-		kfree(param);
+	kfree(param);

 	return ret;
 }
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index a8e1adb..f41d29b 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -853,8 +853,7 @@ static VOID device_free_tx_bufs(PSDevice pDevice) {
             usb_kill_urb(pTxContext->pUrb);
             usb_free_urb(pTxContext->pUrb);
         }
-        if (pTxContext)
-            kfree(pTxContext);
+        kfree(pTxContext);
     }
     return;
 }
@@ -876,8 +875,7 @@ static VOID device_free_rx_bufs(PSDevice pDevice) {
         if (pRCB->skb)
             dev_kfree_skb(pRCB->skb);
     }
-    if (pDevice->pRCBMem)
-        kfree(pDevice->pRCBMem);
+    kfree(pDevice->pRCBMem);

     return;
 }
@@ -894,8 +892,7 @@ static void usb_device_reset(PSDevice pDevice)

 static VOID device_free_int_bufs(PSDevice pDevice) {

-    if (pDevice->intBuf.pDataBuf != NULL)
-        kfree(pDevice->intBuf.pDataBuf);
+    kfree(pDevice->intBuf.pDataBuf);
     return;
 }

@@ -1530,8 +1527,7 @@ error2:
   */

 if(result!=0) {
-    if(buffer)
-  	 kfree(buffer);
+    kfree(buffer);
     buffer=NULL;
 }
   return buffer;
diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c
index 4555bc0..dfa7093 100644
--- a/drivers/staging/vt6656/wpactl.c
+++ b/drivers/staging/vt6656/wpactl.c
@@ -1000,8 +1000,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
 	}

 out:
-	if (param != NULL)
-		kfree(param);
+	kfree(param);

 	return ret;
 }
diff --git a/drivers/staging/winbond/wb35reg.c b/drivers/staging/winbond/wb35reg.c
index 1b93547..4e3092e 100644
--- a/drivers/staging/winbond/wb35reg.c
+++ b/drivers/staging/winbond/wb35reg.c
@@ -66,8 +66,7 @@ Wb35Reg_BurstWrite(struct hw_data * pHwData, u16 RegisterNo, u32 * pRegisterData
 	} else {
 		if (urb)
 			usb_free_urb(urb);
-		if (reg_queue)
-			kfree(reg_queue);
+		kfree(reg_queue);
 		return false;
 	}
    return false;
diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index d383ea8..246d74e 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -435,8 +435,7 @@ void free_chunks(imgchunk_t *fchunk, unsigned int *nfchunks)
 {
 	int i;
 	for (i = 0; i < *nfchunks; i++) {
-		if (fchunk[i].data != NULL)
-			kfree(fchunk[i].data);
+		kfree(fchunk[i].data);
 	}
 	*nfchunks = 0;
 	memset(fchunk, 0, sizeof(*fchunk));
-- 
1.7.1.250.g7d1e8


From 7b084201d1d4490d595b666b6cc19d7cbb8c7ca1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 09:58:27 +0100
Subject: [PATCH 2/8] arch/{arm,powerpc,um}: remove unnecessary if-before-kfree tests


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 arch/arm/mach-omap2/pm-debug.c            |    3 +--
 arch/arm/plat-omap/mcbsp.c                |    3 +--
 arch/powerpc/platforms/powermac/low_i2c.c |    3 +--
 arch/um/kernel/skas/mmu.c                 |    3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 6cac981..b450e29 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -289,8 +289,7 @@ static int pm_dbg_show_regs(struct seq_file *s, void *unused)
 		i++;
 	}

-	if (store != NULL)
-		kfree(store);
+	kfree(store);

 	return 0;
 }
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index e1d0440..3f41d60 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -795,8 +795,7 @@ void omap_mcbsp_free(unsigned int id)
 	mcbsp->reg_cache = NULL;
 	spin_unlock(&mcbsp->lock);

-	if (reg_cache)
-		kfree(reg_cache);
+	kfree(reg_cache);
 }
 EXPORT_SYMBOL(omap_mcbsp_free);

diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index f45331a..caa50e2 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1258,8 +1258,7 @@ static void pmac_i2c_do_end(struct pmf_function *func, void *instdata)
 	if (inst == NULL)
 		return;
 	pmac_i2c_close(inst->bus);
-	if (inst)
-		kfree(inst);
+	kfree(inst);
 }

 static int pmac_i2c_do_read(PMF_STD_ARGS, u32 len)
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 3d099f9..e36210d 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -151,8 +151,7 @@ void arch_exit_mmap(struct mm_struct *mm)
 {
 	pte_t *pte;

-	if (mm->context.stub_pages != NULL)
-		kfree(mm->context.stub_pages);
+	kfree(mm->context.stub_pages);
 	pte = virt_to_pte(mm, STUB_CODE);
 	if (pte != NULL)
 		pte_clear(mm, STUB_CODE, pte);
-- 
1.7.1.250.g7d1e8


From c51b8bd4f99028e814b84f25eca42b1e0319dbfb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 10:01:52 +0100
Subject: [PATCH 3/8] drivers/[a-g]*: remove unnecessary if-before-kfree tests


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 drivers/acpi/processor_core.c              |    3 +--
 drivers/ata/sata_fsl.c                     |    3 +--
 drivers/block/z2ram.c                      |    5 +----
 drivers/char/hvc_iucv.c                    |    3 +--
 drivers/char/n_hdlc.c                      |   20 ++++++++------------
 drivers/char/pcmcia/ipwireless/hardware.c  |    3 +--
 drivers/crypto/talitos.c                   |    3 +--
 drivers/gpu/drm/i915/intel_dvo.c           |    3 +--
 drivers/gpu/drm/radeon/atom.c              |    3 +--
 drivers/gpu/drm/radeon/radeon_connectors.c |    6 ++----
 drivers/gpu/drm/radeon/radeon_display.c    |    4 +---
 11 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 5128435..ee9bd4a 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -164,8 +164,7 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
 	}

 exit:
-	if (buffer.pointer)
-		kfree(buffer.pointer);
+	kfree(buffer.pointer);
 	return apic_id;
 }

diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index a69192b..627fd95 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1364,8 +1364,7 @@ error_exit_with_cleanup:

 	if (hcr_base)
 		iounmap(hcr_base);
-	if (host_priv)
-		kfree(host_priv);
+	kfree(host_priv);

 	return retval;
 }
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 9114654..963d256 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -397,10 +397,7 @@ static void __exit z2_exit(void)
 	    }
 	}

-	if ( z2ram_map != NULL )
-	{
-	    kfree( z2ram_map );
-	}
+	kfree( z2ram_map );
     }

     return;
diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c
index 5a80ad6..8a32d76 100644
--- a/drivers/char/hvc_iucv.c
+++ b/drivers/char/hvc_iucv.c
@@ -1313,8 +1313,7 @@ out_error_memory:
 	mempool_destroy(hvc_iucv_mempool);
 	kmem_cache_destroy(hvc_iucv_buffer_cache);
 out_error:
-	if (hvc_iucv_filter)
-		kfree(hvc_iucv_filter);
+	kfree(hvc_iucv_filter);
 	hvc_iucv_devices = 0; /* ensure that we do not provide any device */
 	return rc;
 }
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index c68118e..414c691 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -260,31 +260,27 @@ static void n_hdlc_release(struct n_hdlc *n_hdlc)
 	/* Release transmit and receive buffers */
 	for(;;) {
 		buf = n_hdlc_buf_get(&n_hdlc->rx_free_buf_list);
-		if (buf) {
-			kfree(buf);
-		} else
+		if (!buf)
 			break;
+		kfree(buf);
 	}
 	for(;;) {
 		buf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list);
-		if (buf) {
-			kfree(buf);
-		} else
+		if (!buf)
 			break;
+		kfree(buf);
 	}
 	for(;;) {
 		buf = n_hdlc_buf_get(&n_hdlc->rx_buf_list);
-		if (buf) {
-			kfree(buf);
-		} else
+		if (!buf)
 			break;
+		kfree(buf);
 	}
 	for(;;) {
 		buf = n_hdlc_buf_get(&n_hdlc->tx_buf_list);
-		if (buf) {
-			kfree(buf);
-		} else
+		if (!buf)
 			break;
+		kfree(buf);
 	}
 	kfree(n_hdlc->tbuf);
 	kfree(n_hdlc);
diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/char/pcmcia/ipwireless/hardware.c
index 99cffda..e1a703a 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.c
+++ b/drivers/char/pcmcia/ipwireless/hardware.c
@@ -1732,8 +1732,7 @@ void ipwireless_hardware_free(struct ipw_hardware *hw)
 	flush_scheduled_work();

 	for (i = 0; i < NL_NUM_OF_ADDRESSES; i++)
-		if (hw->packet_assembler[i] != NULL)
-			kfree(hw->packet_assembler[i]);
+		kfree(hw->packet_assembler[i]);

 	for (i = 0; i < NL_NUM_OF_PRIORITIES; i++)
 		list_for_each_entry_safe(tp, tq, &hw->tx_queue[i], queue) {
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index dc558a0..8425b64 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1756,8 +1756,7 @@ static int talitos_remove(struct of_device *ofdev)
 		talitos_unregister_rng(dev);

 	for (i = 0; i < priv->num_channels; i++)
-		if (priv->chan[i].fifo)
-			kfree(priv->chan[i].fifo);
+		kfree(priv->chan[i].fifo);

 	kfree(priv->chan);

diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index ebf213c..cb581d8 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -281,8 +281,7 @@ static void intel_dvo_destroy (struct drm_connector *connector)
 	if (dvo) {
 		if (dvo->dev_ops->destroy)
 			dvo->dev_ops->destroy(dvo);
-		if (dvo->panel_fixed_mode)
-			kfree(dvo->panel_fixed_mode);
+		kfree(dvo->panel_fixed_mode);
 		/* no need, in i830_dvoices[] now */
 		//kfree(dvo);
 	}
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 1d56983..8a5b15d 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -1304,8 +1304,7 @@ int atom_asic_init(struct atom_context *ctx)

 void atom_destroy(struct atom_context *ctx)
 {
-	if (ctx->iio)
-		kfree(ctx->iio);
+	kfree(ctx->iio);
 	kfree(ctx);
 }

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 4559a53..cf7fb36 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -506,8 +506,7 @@ static void radeon_connector_destroy(struct drm_connector *connector)

 	if (radeon_connector->ddc_bus)
 		radeon_i2c_destroy(radeon_connector->ddc_bus);
-	if (radeon_connector->edid)
-		kfree(radeon_connector->edid);
+	kfree(radeon_connector->edid);
 	kfree(radeon_connector->con_priv);
 	drm_sysfs_connector_remove(connector);
 	drm_connector_cleanup(connector);
@@ -946,8 +945,7 @@ static void radeon_dp_connector_destroy(struct drm_connector *connector)

 	if (radeon_connector->ddc_bus)
 		radeon_i2c_destroy(radeon_connector->ddc_bus);
-	if (radeon_connector->edid)
-		kfree(radeon_connector->edid);
+	kfree(radeon_connector->edid);
 	if (radeon_dig_connector->dp_i2c_bus)
 		radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus);
 	kfree(radeon_connector->con_priv);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index bb1c122..e7c2788 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -429,9 +429,7 @@ static int radeon_ddc_dump(struct drm_connector *connector)
 	if (!radeon_connector->ddc_bus)
 		return -1;
 	edid = drm_get_edid(connector, &radeon_connector->ddc_bus->adapter);
-	if (edid) {
-		kfree(edid);
-	}
+	kfree(edid);
 	return ret;
 }

-- 
1.7.1.250.g7d1e8


From e2c184980d107c47f7258ce2919c18f7cee9221e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 10:02:06 +0100
Subject: [PATCH 4/8] drivers/[i-m]*: remove unnecessary if-before-kfree tests


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 drivers/macintosh/windfarm_pm81.c        |    6 ++----
 drivers/macintosh/windfarm_pm91.c        |    3 +--
 drivers/media/dvb/dvb-usb/cinergyT2-fe.c |    3 +--
 drivers/media/dvb/siano/smscoreapi.c     |    3 +--
 drivers/media/video/ivtv/ivtvfb.c        |    3 +--
 drivers/message/fusion/mptfc.c           |    3 +--
 drivers/message/fusion/mptspi.c          |    3 +--
 drivers/misc/sgi-xp/xpc_partition.c      |    3 +--
 drivers/mmc/card/queue.c                 |   15 +++++----------
 drivers/mmc/core/bus.c                   |    3 +--
 drivers/mmc/core/sdio_bus.c              |    3 +--
 drivers/mtd/chips/cfi_cmdset_0001.c      |    3 +--
 drivers/mtd/maps/ck804xrom.c             |    3 +--
 13 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c
index 565d5b2..e6e46a2 100644
--- a/drivers/macintosh/windfarm_pm81.c
+++ b/drivers/macintosh/windfarm_pm81.c
@@ -757,10 +757,8 @@ static int __devexit wf_smu_remove(struct platform_device *ddev)
 		wf_put_control(cpufreq_clamp);

 	/* Destroy control loops state structures */
-	if (wf_smu_sys_fans)
-		kfree(wf_smu_sys_fans);
-	if (wf_smu_cpu_fans)
-		kfree(wf_smu_cpu_fans);
+	kfree(wf_smu_sys_fans);
+	kfree(wf_smu_cpu_fans);

 	return 0;
 }
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c
index bea9916..791d113 100644
--- a/drivers/macintosh/windfarm_pm91.c
+++ b/drivers/macintosh/windfarm_pm91.c
@@ -691,8 +691,7 @@ static int __devexit wf_smu_remove(struct platform_device *ddev)
 		kfree(wf_smu_cpu_fans);
 	if (wf_smu_drive_fans)
 		kfree(wf_smu_cpu_fans);
-	if (wf_smu_cpu_fans)
-		kfree(wf_smu_cpu_fans);
+	kfree(wf_smu_cpu_fans);

 	return 0;
 }
diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-fe.c b/drivers/media/dvb/dvb-usb/cinergyT2-fe.c
index 9cd51ac..17919eb 100644
--- a/drivers/media/dvb/dvb-usb/cinergyT2-fe.c
+++ b/drivers/media/dvb/dvb-usb/cinergyT2-fe.c
@@ -295,8 +295,7 @@ static int cinergyt2_fe_get_frontend(struct dvb_frontend *fe,
 static void cinergyt2_fe_release(struct dvb_frontend *fe)
 {
 	struct cinergyt2_fe_state *state = fe->demodulator_priv;
-	if (state != NULL)
-		kfree(state);
+	kfree(state);
 }

 static struct dvb_frontend_ops cinergyt2_fe_ops;
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index 0c87a3c..97a8668 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -724,8 +724,7 @@ void smscore_unregister_device(struct smscore_device_t *coredev)
 		dma_free_coherent(NULL, coredev->common_buffer_size,
 			coredev->common_buffer, coredev->common_buffer_phys);

-	if (coredev->fw_buf != NULL)
-		kfree(coredev->fw_buf);
+	kfree(coredev->fw_buf);

 	list_del(&coredev->entry);
 	kfree(coredev);
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c
index de2ff1c..2b82053 100644
--- a/drivers/media/video/ivtv/ivtvfb.c
+++ b/drivers/media/video/ivtv/ivtvfb.c
@@ -1125,8 +1125,7 @@ static void ivtvfb_release_buffers (struct ivtv *itv)
 		fb_dealloc_cmap(&oi->ivtvfb_info.cmap);

 	/* Release pseudo palette */
-	if (oi->ivtvfb_info.pseudo_palette)
-		kfree(oi->ivtvfb_info.pseudo_palette);
+	kfree(oi->ivtvfb_info.pseudo_palette);

 #ifdef CONFIG_MTRR
 	if (oi->fb_end_aligned_physaddr) {
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 33f7256..8a6b63d 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -525,8 +525,7 @@ mptfc_target_destroy(struct scsi_target *starget)
 		if (ri)	/* better be! */
 			ri->starget = NULL;
 	}
-	if (starget->hostdata)
-		kfree(starget->hostdata);
+	kfree(starget->hostdata);
 	starget->hostdata = NULL;
 }

diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index e443651..e89f585 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -457,8 +457,7 @@ static int mptspi_target_alloc(struct scsi_target *starget)
 static void
 mptspi_target_destroy(struct scsi_target *starget)
 {
-	if (starget->hostdata)
-		kfree(starget->hostdata);
+	kfree(starget->hostdata);
 	starget->hostdata = NULL;
 }

diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index d551f09..533b386 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -98,8 +98,7 @@ xpc_get_rsvd_page_pa(int nasid)
 			len = L1_CACHE_ALIGN(len);

 		if (len > buf_len) {
-			if (buf_base != NULL)
-				kfree(buf_base);
+			kfree(buf_base);
 			buf_len = L1_CACHE_ALIGN(len);
 			buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
 							    &buf_base);
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index d6ded24..8336a6f 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -204,15 +204,12 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock

 	return 0;
  free_bounce_sg:
- 	if (mq->bounce_sg)
- 		kfree(mq->bounce_sg);
+	kfree(mq->bounce_sg);
  	mq->bounce_sg = NULL;
  cleanup_queue:
- 	if (mq->sg)
-		kfree(mq->sg);
+	kfree(mq->sg);
 	mq->sg = NULL;
-	if (mq->bounce_buf)
-		kfree(mq->bounce_buf);
+	kfree(mq->bounce_buf);
 	mq->bounce_buf = NULL;
 	blk_cleanup_queue(mq->queue);
 	return ret;
@@ -235,15 +232,13 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
 	blk_start_queue(q);
 	spin_unlock_irqrestore(q->queue_lock, flags);

- 	if (mq->bounce_sg)
- 		kfree(mq->bounce_sg);
+	kfree(mq->bounce_sg);
  	mq->bounce_sg = NULL;

 	kfree(mq->sg);
 	mq->sg = NULL;

-	if (mq->bounce_buf)
-		kfree(mq->bounce_buf);
+	kfree(mq->bounce_buf);
 	mq->bounce_buf = NULL;

 	mq->card = NULL;
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 49d9dca..cbb72f4 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -188,8 +188,7 @@ static void mmc_release_card(struct device *dev)

 	sdio_free_common_cis(card);

-	if (card->info)
-		kfree(card->info);
+	kfree(card->info);

 	kfree(card);
 }
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 4a890dc..5dda49e 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -202,8 +202,7 @@ static void sdio_release_func(struct device *dev)

 	sdio_free_func_cis(func);

-	if (func->info)
-		kfree(func->info);
+	kfree(func->info);

 	kfree(func);
 }
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5fbf29e..706257b 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -2610,8 +2610,7 @@ static void cfi_intelext_destroy(struct mtd_info *mtd)
 	kfree(cfi);
 	for (i = 0; i < mtd->numeraseregions; i++) {
 		region = &mtd->eraseregions[i];
-		if (region->lockmap)
-			kfree(region->lockmap);
+		kfree(region->lockmap);
 	}
 	kfree(mtd->eraseregions);
 }
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index ddb462b..bb79315 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -311,8 +311,7 @@ static int __devinit ck804xrom_init_one (struct pci_dev *pdev,

  out:
 	/* Free any left over map structures */
-	if (map)
-		kfree(map);
+	kfree(map);

 	/* See if I have any map structures */
 	if (list_empty(&window->maps)) {
-- 
1.7.1.250.g7d1e8


From c7289754b27b93e11b07ced7a7dbac63fce36544 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 10:04:43 +0100
Subject: [PATCH 5/8] drivers/{net,rtc,s390}: remove unnecessary if-before-kfree tests


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 drivers/net/forcedeth.c                      |   12 ++++--------
 drivers/net/irda/kingsun-sir.c               |    4 ++--
 drivers/net/ixgbe/ixgbe_main.c               |    3 +--
 drivers/net/myri10ge/myri10ge.c              |    3 +--
 drivers/net/netxen/netxen_nic_main.c         |    3 +--
 drivers/net/ppp_mppe.c                       |    6 ++----
 drivers/net/qla3xxx.c                        |    2 +-
 drivers/net/qlcnic/qlcnic_main.c             |    3 +--
 drivers/net/stmmac/stmmac_main.c             |    3 +--
 drivers/net/usb/hso.c                        |    3 +--
 drivers/net/wireless/ath/ath5k/attach.c      |    3 +--
 drivers/net/wireless/ipw2x00/libipw_module.c |    3 +--
 drivers/rtc/rtc-m48t59.c                     |    3 +--
 drivers/s390/char/monreader.c                |    3 +--
 14 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 5c98f7c..5c9850f 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -1013,10 +1013,8 @@ static void free_rings(struct net_device *dev)
 			pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (np->rx_ring_size + np->tx_ring_size),
 					    np->rx_ring.ex, np->ring_addr);
 	}
-	if (np->rx_skb)
-		kfree(np->rx_skb);
-	if (np->tx_skb)
-		kfree(np->tx_skb);
+	kfree(np->rx_skb);
+	kfree(np->tx_skb);
 }

 static int using_multi_irqs(struct net_device *dev)
@@ -4649,10 +4647,8 @@ static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ri
 				pci_free_consistent(np->pci_dev, sizeof(struct ring_desc_ex) * (ring->rx_pending + ring->tx_pending),
 						    rxtx_ring, ring_addr);
 		}
-		if (rx_skbuff)
-			kfree(rx_skbuff);
-		if (tx_skbuff)
-			kfree(tx_skbuff);
+		kfree(rx_skbuff);
+		kfree(tx_skbuff);
 		goto exit;
 	}

diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c
index cb90d64..608fa47 100644
--- a/drivers/net/irda/kingsun-sir.c
+++ b/drivers/net/irda/kingsun-sir.c
@@ -544,8 +544,8 @@ static int kingsun_probe(struct usb_interface *intf,
 	return 0;

 free_mem:
-	if (kingsun->out_buf) kfree(kingsun->out_buf);
-	if (kingsun->in_buf) kfree(kingsun->in_buf);
+	kfree(kingsun->out_buf);
+	kfree(kingsun->in_buf);
 	free_netdev(net);
 err_out1:
 	return ret;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 6c00ee4..36f2984 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -167,8 +167,7 @@ static inline void ixgbe_disable_sriov(struct ixgbe_adapter *adapter)

 	/* take a breather then clean up driver data */
 	msleep(100);
-	if (adapter->vfinfo)
-		kfree(adapter->vfinfo);
+	kfree(adapter->vfinfo);
 	adapter->vfinfo = NULL;

 	adapter->num_vfs = 0;
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index ecde087..5b0322c 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -4028,8 +4028,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
 		mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
 #endif
 	myri10ge_free_slices(mgp);
-	if (mgp->msix_vectors != NULL)
-		kfree(mgp->msix_vectors);
+	kfree(mgp->msix_vectors);
 	dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
 			  mgp->cmd, mgp->cmd_bus);

diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index ce838f7..c6265f4 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -183,8 +183,7 @@ netxen_alloc_sds_rings(struct netxen_recv_context *recv_ctx, int count)
 static void
 netxen_free_sds_rings(struct netxen_recv_context *recv_ctx)
 {
-	if (recv_ctx->sds_rings != NULL)
-		kfree(recv_ctx->sds_rings);
+	kfree(recv_ctx->sds_rings);

 	recv_ctx->sds_rings = NULL;
 }
diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c
index 6d1a1b8..8e8cf7e 100644
--- a/drivers/net/ppp_mppe.c
+++ b/drivers/net/ppp_mppe.c
@@ -238,8 +238,7 @@ static void *mppe_alloc(unsigned char *options, int optlen)
 	return (void *)state;

 	out_free:
-	    if (state->sha1_digest)
-		kfree(state->sha1_digest);
+	    kfree(state->sha1_digest);
 	    if (state->sha1)
 		crypto_free_hash(state->sha1);
 	    if (state->arc4)
@@ -256,8 +255,7 @@ static void mppe_free(void *arg)
 {
 	struct ppp_mppe_state *state = (struct ppp_mppe_state *) arg;
 	if (state) {
-	    if (state->sha1_digest)
-		kfree(state->sha1_digest);
+	    kfree(state->sha1_digest);
 	    if (state->sha1)
 		crypto_free_hash(state->sha1);
 	    if (state->arc4)
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 4ef0afb..f54fdbc 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2755,7 +2755,7 @@ static void ql_free_buffer_queues(struct ql3_adapter *qdev)
 		       "%s: Already done.\n", qdev->ndev->name);
 		return;
 	}
-	if(qdev->lrg_buf) kfree(qdev->lrg_buf);
+	kfree(qdev->lrg_buf);
 	pci_free_consistent(qdev->pdev,
 			    qdev->lrg_buf_q_alloc_size,
 			    qdev->lrg_buf_q_alloc_virt_addr,
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 234dab1..63ade4b 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -161,8 +161,7 @@ qlcnic_alloc_sds_rings(struct qlcnic_recv_context *recv_ctx, int count)
 static void
 qlcnic_free_sds_rings(struct qlcnic_recv_context *recv_ctx)
 {
-	if (recv_ctx->sds_rings != NULL)
-		kfree(recv_ctx->sds_rings);
+	kfree(recv_ctx->sds_rings);

 	recv_ctx->sds_rings = NULL;
 }
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index 4111a85..6d901c1 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -938,8 +938,7 @@ static int stmmac_release(struct net_device *dev)
 #ifdef CONFIG_STMMAC_TIMER
 	/* Stop and release the timer */
 	stmmac_close_ext_timer();
-	if (priv->tm != NULL)
-		kfree(priv->tm);
+	kfree(priv->tm);
 #endif
 	napi_disable(&priv->napi);
 	skb_queue_purge(&priv->rx_recycle);
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index be0cc99..b0ca05e 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2825,8 +2825,7 @@ exit:
 		tty_unregister_device(tty_drv, serial->minor);
 		kfree(serial);
 	}
-	if (hso_dev)
-		kfree(hso_dev);
+	kfree(hso_dev);
 	return NULL;

 }
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index dc0786c..59bf71e 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -354,8 +354,7 @@ void ath5k_hw_detach(struct ath5k_hw *ah)

 	__set_bit(ATH_STAT_INVALID, ah->ah_sc->status);

-	if (ah->ah_rf_banks != NULL)
-		kfree(ah->ah_rf_banks);
+	kfree(ah->ah_rf_banks);

 	ath5k_eeprom_detach(ah);

diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c
index 2fa5586..4ccfee9 100644
--- a/drivers/net/wireless/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/ipw2x00/libipw_module.c
@@ -99,8 +99,7 @@ static inline void libipw_networks_free(struct libipw_device *ieee)
 	int i;

 	for (i = 0; i < MAX_NETWORK_COUNT; i++) {
-		if (ieee->networks[i]->ibss_dfs)
-			kfree(ieee->networks[i]->ibss_dfs);
+		kfree(ieee->networks[i]->ibss_dfs);
 		kfree(ieee->networks[i]);
 	}
 }
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 365ff3a..39663e9 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -506,8 +506,7 @@ out:
 		free_irq(m48t59->irq, &pdev->dev);
 	if (m48t59->ioaddr)
 		iounmap(m48t59->ioaddr);
-	if (m48t59)
-		kfree(m48t59);
+	kfree(m48t59);
 	return ret;
 }

diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c
index 2ed3f82..b8450e1 100644
--- a/drivers/s390/char/monreader.c
+++ b/drivers/s390/char/monreader.c
@@ -174,8 +174,7 @@ static void mon_free_mem(struct mon_private *monpriv)
 	int i;

 	for (i = 0; i < MON_MSGLIM; i++)
-		if (monpriv->msg_array[i])
-			kfree(monpriv->msg_array[i]);
+		kfree(monpriv->msg_array[i]);
 	kfree(monpriv);
 }

-- 
1.7.1.250.g7d1e8


From c904ee0fbda5c78aff7fdcf215c56d4149dc9f00 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 10:05:37 +0100
Subject: [PATCH 6/8] drivers/{scsi,usb,uwb,video}: remove unnecessary if-before-kfree tests


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 drivers/scsi/aic7xxx/aicasm/aicasm_scan.l   |    3 +--
 drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c |   12 ++++--------
 drivers/scsi/aic94xx/aic94xx_init.c         |    3 +--
 drivers/scsi/lpfc/lpfc_bsg.c                |    3 +--
 drivers/usb/serial/mos7840.c                |    7 ++-----
 drivers/uwb/wlp/wlp-lc.c                    |    3 +--
 drivers/video/au1200fb.c                    |    6 ++----
 drivers/video/console/softcursor.c          |    3 +--
 drivers/video/uvesafb.c                     |   18 ++++++------------
 9 files changed, 19 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
index 93c8667..1ffe8fa 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
@@ -606,8 +606,7 @@ yywrap()

 	yy_delete_buffer(YY_CURRENT_BUFFER);
 	(void)fclose(yyin);
-	if (yyfilename != NULL)
-		free(yyfilename);
+	free(yyfilename);
 	yyfilename = NULL;
 	include = include_stack.slh_first;
 	if (include != NULL) {
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
index 078ed60..5b9edb6 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
@@ -95,12 +95,10 @@ symbol_delete(symbol_t *symbol)
 	case SCBLOC:
 	case SRAMLOC:
 	case REGISTER:
-		if (symbol->info.rinfo != NULL)
-			free(symbol->info.rinfo);
+		free(symbol->info.rinfo);
 		break;
 	case ALIAS:
-		if (symbol->info.ainfo != NULL)
-			free(symbol->info.ainfo);
+		free(symbol->info.ainfo);
 		break;
 	case MASK:
 	case FIELD:
@@ -113,12 +111,10 @@ symbol_delete(symbol_t *symbol)
 		break;
 	case DOWNLOAD_CONST:
 	case CONST:
-		if (symbol->info.cinfo != NULL)
-			free(symbol->info.cinfo);
+		free(symbol->info.cinfo);
 		break;
 	case LABEL:
-		if (symbol->info.linfo != NULL)
-			free(symbol->info.linfo);
+		free(symbol->info.linfo);
 		break;
 	case UNINITIALIZED:
 	default:
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 24ac231..d6b3959 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -599,8 +599,7 @@ static void asd_destroy_ha_caches(struct asd_ha_struct *asd_ha)
 	if (asd_ha->hw_prof.scb_ext)
 		asd_free_coherent(asd_ha, asd_ha->hw_prof.scb_ext);

-	if (asd_ha->hw_prof.ddb_bitmap)
-		kfree(asd_ha->hw_prof.ddb_bitmap);
+	kfree(asd_ha->hw_prof.ddb_bitmap);
 	asd_ha->hw_prof.ddb_bitmap = NULL;

 	for (i = 0; i < ASD_MAX_PHYS; i++) {
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index d62b3e4..0b8024f 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -1064,8 +1064,7 @@ lpfc_bsg_hba_set_event(struct fc_bsg_job *job)
 	return 0; /* call job done later */

 job_error:
-	if (dd_data != NULL)
-		kfree(dd_data);
+	kfree(dd_data);

 	job->dd_data = NULL;
 	return rc;
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 2fda1c0..8a03722 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1216,9 +1216,7 @@ static void mos7840_close(struct usb_serial_port *port)
 	/* Freeing Write URBs */
 	for (j = 0; j < NUM_URBS; ++j) {
 		if (mos7840_port->write_urb_pool[j]) {
-			if (mos7840_port->write_urb_pool[j]->transfer_buffer)
-				kfree(mos7840_port->write_urb_pool[j]->
-				      transfer_buffer);
+			kfree(mos7840_port->write_urb_pool[j]->transfer_buffer);

 			usb_free_urb(mos7840_port->write_urb_pool[j]);
 		}
@@ -1255,8 +1253,7 @@ static void mos7840_close(struct usb_serial_port *port)

 	if (mos7840_port->write_urb) {
 		/* if this urb had a transfer buffer already (old tx) free it */
-		if (mos7840_port->write_urb->transfer_buffer != NULL)
-			kfree(mos7840_port->write_urb->transfer_buffer);
+		kfree(mos7840_port->write_urb->transfer_buffer);
 		usb_free_urb(mos7840_port->write_urb);
 	}

diff --git a/drivers/uwb/wlp/wlp-lc.c b/drivers/uwb/wlp/wlp-lc.c
index 7f6a630..80d6ce8 100644
--- a/drivers/uwb/wlp/wlp-lc.c
+++ b/drivers/uwb/wlp/wlp-lc.c
@@ -539,8 +539,7 @@ void wlp_remove(struct wlp *wlp)
 	uwb_notifs_deregister(wlp->rc, &wlp->uwb_notifs_handler);
 	wlp_eda_release(&wlp->eda);
 	mutex_lock(&wlp->mutex);
-	if (wlp->dev_info != NULL)
-		kfree(wlp->dev_info);
+	kfree(wlp->dev_info);
 	mutex_unlock(&wlp->mutex);
 	wlp->rc = NULL;
 }
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index e77e8e4..58e689b 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1709,8 +1709,7 @@ failed:
 				fbdev->fb_mem, fbdev->fb_phys);
 	if (fbdev->fb_info.cmap.len != 0)
 		fb_dealloc_cmap(&fbdev->fb_info.cmap);
-	if (fbdev->fb_info.pseudo_palette)
-		kfree(fbdev->fb_info.pseudo_palette);
+	kfree(fbdev->fb_info.pseudo_palette);
 	if (plane == 0)
 		free_irq(AU1200_LCD_INT, (void*)dev);
 	return ret;
@@ -1739,8 +1738,7 @@ static int au1200fb_drv_remove(struct platform_device *dev)
 					fbdev->fb_mem, fbdev->fb_phys);
 		if (fbdev->fb_info.cmap.len != 0)
 			fb_dealloc_cmap(&fbdev->fb_info.cmap);
-		if (fbdev->fb_info.pseudo_palette)
-			kfree(fbdev->fb_info.pseudo_palette);
+		kfree(fbdev->fb_info.pseudo_palette);
 	}

 	free_irq(AU1200_LCD_INT, (void *)dev);
diff --git a/drivers/video/console/softcursor.c b/drivers/video/console/softcursor.c
index 25f835b..46dd8f5 100644
--- a/drivers/video/console/softcursor.c
+++ b/drivers/video/console/softcursor.c
@@ -35,8 +35,7 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
 	dsize = s_pitch * cursor->image.height;

 	if (dsize + sizeof(struct fb_image) != ops->cursor_size) {
-		if (ops->cursor_src != NULL)
-			kfree(ops->cursor_src);
+		kfree(ops->cursor_src);
 		ops->cursor_size = dsize + sizeof(struct fb_image);

 		ops->cursor_src = kmalloc(ops->cursor_size, GFP_ATOMIC);
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 7b8839e..23194af 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -236,8 +236,7 @@ out:
 static void uvesafb_free(struct uvesafb_ktask *task)
 {
 	if (task) {
-		if (task->done)
-			kfree(task->done);
+		kfree(task->done);
 		kfree(task);
 	}
 }
@@ -1319,8 +1318,7 @@ setmode:
 				FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
 	info->fix.line_length = mode->bytes_per_scan_line;

-out:	if (crtc != NULL)
-		kfree(crtc);
+out:	kfree(crtc);
 	uvesafb_free(task);

 	return err;
@@ -1797,8 +1795,7 @@ out_mode:
 	fb_destroy_modedb(info->monspecs.modedb);
 	fb_dealloc_cmap(&info->cmap);
 out:
-	if (par->vbe_modes)
-		kfree(par->vbe_modes);
+	kfree(par->vbe_modes);

 	framebuffer_release(info);
 	return err;
@@ -1820,12 +1817,9 @@ static int uvesafb_remove(struct platform_device *dev)
 		fb_dealloc_cmap(&info->cmap);

 		if (par) {
-			if (par->vbe_modes)
-				kfree(par->vbe_modes);
-			if (par->vbe_state_orig)
-				kfree(par->vbe_state_orig);
-			if (par->vbe_state_saved)
-				kfree(par->vbe_state_saved);
+			kfree(par->vbe_modes);
+			kfree(par->vbe_state_orig);
+			kfree(par->vbe_state_saved);
 		}

 		framebuffer_release(info);
-- 
1.7.1.250.g7d1e8


From 64c37156ebf8a9fa7d13a45fb80982d67259e3d0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 10:05:58 +0100
Subject: [PATCH 7/8] fs: remove unnecessary if-before-kfree tests


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 fs/btrfs/free-space-cache.c  |    6 ++----
 fs/ceph/crush/crush.c        |    2 +-
 fs/dlm/memory.c              |    3 +--
 fs/ecryptfs/keystore.c       |    3 +--
 fs/ecryptfs/messaging.c      |    6 ++----
 fs/jffs2/acl.c               |    3 +--
 fs/jffs2/scan.c              |    3 +--
 fs/jffs2/xattr.c             |    3 +--
 fs/nfs/nfs4proc.c            |    3 +--
 fs/ocfs2/alloc.c             |    3 +--
 fs/ocfs2/cluster/heartbeat.c |    6 ++----
 fs/ocfs2/cluster/tcp.c       |    6 ++----
 fs/ocfs2/dlm/dlmdomain.c     |    3 +--
 fs/ocfs2/dlm/dlmrecovery.c   |    6 ++----
 fs/ocfs2/extent_map.c        |    3 +--
 fs/ocfs2/journal.c           |    9 +++------
 fs/ocfs2/localalloc.c        |    6 ++----
 fs/ocfs2/super.c             |    6 ++----
 18 files changed, 27 insertions(+), 53 deletions(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index f488fac..feea513 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -598,8 +598,7 @@ new_bitmap:

 out:
 	if (info) {
-		if (info->bitmap)
-			kfree(info->bitmap);
+		kfree(info->bitmap);
 		kfree(info);
 	}

@@ -904,8 +903,7 @@ void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group)
 	while ((node = rb_last(&block_group->free_space_offset)) != NULL) {
 		info = rb_entry(node, struct btrfs_free_space, offset_index);
 		unlink_free_space(block_group, info);
-		if (info->bitmap)
-			kfree(info->bitmap);
+		kfree(info->bitmap);
 		kfree(info);
 		if (need_resched()) {
 			spin_unlock(&block_group->tree_lock);
diff --git a/fs/ceph/crush/crush.c b/fs/ceph/crush/crush.c
index fabd302..acc0a08 100644
--- a/fs/ceph/crush/crush.c
+++ b/fs/ceph/crush/crush.c
@@ -4,7 +4,7 @@
 #else
 # include <stdlib.h>
 # include <assert.h>
-# define kfree(x) do { if (x) free(x); } while (0)
+# define kfree(x) free(x)
 # define BUG_ON(x) assert(!(x))
 #endif

diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 8e0d00d..6f1edc7 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -82,8 +82,7 @@ void dlm_free_lkb(struct dlm_lkb *lkb)
 		struct dlm_user_args *ua;
 		ua = lkb->lkb_ua;
 		if (ua) {
-			if (ua->lksb.sb_lvbptr)
-				kfree(ua->lksb.sb_lvbptr);
+			kfree(ua->lksb.sb_lvbptr);
 			kfree(ua);
 		}
 	}
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 89c5476..fadc03c 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -1077,8 +1077,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
 				  crypt_stat->key_size);
 	}
 out:
-	if (msg)
-		kfree(msg);
+	kfree(msg);
 	return rc;
 }

diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index 2d8dbce..a74dd34 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -97,8 +97,7 @@ static void ecryptfs_msg_ctx_free_to_alloc(struct ecryptfs_msg_ctx *msg_ctx)
 void ecryptfs_msg_ctx_alloc_to_free(struct ecryptfs_msg_ctx *msg_ctx)
 {
 	list_move(&(msg_ctx->node), &ecryptfs_msg_ctx_free_list);
-	if (msg_ctx->msg)
-		kfree(msg_ctx->msg);
+	kfree(msg_ctx->msg);
 	msg_ctx->msg = NULL;
 	msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_FREE;
 }
@@ -541,8 +540,7 @@ void ecryptfs_release_messaging(void)
 		mutex_lock(&ecryptfs_msg_ctx_lists_mux);
 		for (i = 0; i < ecryptfs_message_buf_len; i++) {
 			mutex_lock(&ecryptfs_msg_ctx_arr[i].mux);
-			if (ecryptfs_msg_ctx_arr[i].msg)
-				kfree(ecryptfs_msg_ctx_arr[i].msg);
+			kfree(ecryptfs_msg_ctx_arr[i].msg);
 			mutex_unlock(&ecryptfs_msg_ctx_arr[i].mux);
 		}
 		kfree(ecryptfs_msg_ctx_arr);
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 7cdc319..fcfa5e7 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -190,8 +190,7 @@ static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
 	} else {
 		acl = ERR_PTR(rc);
 	}
-	if (value)
-		kfree(value);
+	kfree(value);
 	if (!IS_ERR(acl))
 		set_cached_acl(inode, type, acl);
 	return acl;
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 696686c..c5f2134 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -270,8 +270,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
 	else
 		c->mtd->unpoint(c->mtd, 0, c->mtd->size);
 #endif
-	if (s)
-		kfree(s);
+	kfree(s);

 	return ret;
 }
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 9e75c62..f574d06 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -744,8 +744,7 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
 	for (i=0; i < XATTRINDEX_HASHSIZE; i++) {
 		list_for_each_entry_safe(xd, _xd, &c->xattrindex[i], xindex) {
 			list_del(&xd->xindex);
-			if (xd->xname)
-				kfree(xd->xname);
+			kfree(xd->xname);
 			jffs2_free_xattr_datum(xd);
 		}
 	}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 071fced..e59f6d6 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2247,8 +2247,7 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct
 out:
 	if (page)
 		__free_page(page);
-	if (locations)
-		kfree(locations);
+	kfree(locations);
 	return status;
 }

diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 9f8bd91..d8701d1 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -7197,8 +7197,7 @@ int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle,
 		mlog_errno(ret);

 out:
-	if (pages)
-		kfree(pages);
+	kfree(pages);

 	return ret;
 }
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 41d5f1f..6ca0b69 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1060,8 +1060,7 @@ static void o2hb_region_release(struct config_item *item)
 	struct page *page;
 	struct o2hb_region *reg = to_o2hb_region(item);

-	if (reg->hr_tmp_block)
-		kfree(reg->hr_tmp_block);
+	kfree(reg->hr_tmp_block);

 	if (reg->hr_slot_data) {
 		for (i = 0; i < reg->hr_num_pages; i++) {
@@ -1075,8 +1074,7 @@ static void o2hb_region_release(struct config_item *item)
 	if (reg->hr_bdev)
 		blkdev_put(reg->hr_bdev, FMODE_READ|FMODE_WRITE);

-	if (reg->hr_slots)
-		kfree(reg->hr_slots);
+	kfree(reg->hr_slots);

 	spin_lock(&o2hb_live_lock);
 	list_del(&reg->hr_all_item);
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 73e743e..6398f0c 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1080,10 +1080,8 @@ out:
 	o2net_debug_del_nst(&nst); /* must be before dropping sc and node */
 	if (sc)
 		sc_put(sc);
-	if (vec)
-		kfree(vec);
-	if (msg)
-		kfree(msg);
+	kfree(vec);
+	kfree(msg);
 	o2net_complete_nsw(nn, &nsw, 0, 0, 0);
 	return ret;
 }
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 988c905..51311ae 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -306,8 +306,7 @@ static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
 	if (dlm->master_hash)
 		dlm_free_pagevec((void **)dlm->master_hash, DLM_HASH_PAGES);

-	if (dlm->name)
-		kfree(dlm->name);
+	kfree(dlm->name);

 	kfree(dlm);
 }
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index b4f99de..fec7c6d 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1488,10 +1488,8 @@ leave:

 	dlm_put(dlm);
 	if (ret < 0) {
-		if (buf)
-			kfree(buf);
-		if (item)
-			kfree(item);
+		kfree(buf);
+		kfree(item);
 	}

 	mlog_exit(ret);
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 09e3fdf..5f2a184 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -282,8 +282,7 @@ search:
 	spin_unlock(&oi->ip_lock);

 out:
-	if (new_emi)
-		kfree(new_emi);
+	kfree(new_emi);
 }

 static int ocfs2_last_eb_is_empty(struct inode *inode,
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 9336c60..f1fc7e5 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1278,11 +1278,9 @@ static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal,
 		/* Though we wish to avoid it, we are in fact safe in
 		 * skipping local alloc cleanup as fsck.ocfs2 is more
 		 * than capable of reclaiming unused space. */
-		if (la_dinode)
-			kfree(la_dinode);
+		kfree(la_dinode);

-		if (tl_dinode)
-			kfree(tl_dinode);
+		kfree(tl_dinode);

 		if (qrec)
 			ocfs2_free_quota_recovery(qrec);
@@ -1454,8 +1452,7 @@ bail:

 	mutex_unlock(&osb->recovery_lock);

-	if (rm_quota)
-		kfree(rm_quota);
+	kfree(rm_quota);

 	mlog_exit(status);
 	/* no one is callint kthread_stop() for us so the kthread() api
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index c983715..e126f17 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -337,8 +337,7 @@ out:
 	if (local_alloc_inode)
 		iput(local_alloc_inode);

-	if (alloc_copy)
-		kfree(alloc_copy);
+	kfree(alloc_copy);

 	mlog_exit_void();
 }
@@ -1202,8 +1201,7 @@ bail:
 	if (main_bm_inode)
 		iput(main_bm_inode);

-	if (alloc_copy)
-		kfree(alloc_copy);
+	kfree(alloc_copy);

 	if (ac)
 		ocfs2_free_alloc_context(ac);
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index dee0319..d1fb1db 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2395,8 +2395,7 @@ static int ocfs2_check_volume(struct ocfs2_super *osb)
 		mlog_errno(status);

 finally:
-	if (local_alloc)
-		kfree(local_alloc);
+	kfree(local_alloc);

 	mlog_exit(status);
 	return status;
@@ -2424,8 +2423,7 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb)
 	 * we free it here.
 	 */
 	kfree(osb->journal);
-	if (osb->local_alloc_copy)
-		kfree(osb->local_alloc_copy);
+	kfree(osb->local_alloc_copy);
 	kfree(osb->uuid_str);
 	ocfs2_put_dlm_debug(osb->osb_dlm_debug);
 	memset(osb, 0, sizeof(struct ocfs2_super));
-- 
1.7.1.250.g7d1e8


From 14697e41add7d4a6d058ff61aadfc36f8c84ba7d Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 26 Nov 2009 10:08:16 +0100
Subject: [PATCH 8/8] remainder: remove unnecessary if-before-kfree tests (and some free)


Signed-off-by: Jim Meyering <meyering@redhat.com>
---
 include/net/netfilter/nf_conntrack_extend.h        |    3 +--
 net/tipc/name_distr.c                              |    4 +---
 scripts/dtc/data.c                                 |    3 +--
 scripts/genksyms/lex.c_shipped                     |    3 +--
 scripts/genksyms/lex.l                             |    3 +--
 scripts/kconfig/confdata.c                         |    3 +--
 scripts/kconfig/util.c                             |    3 +--
 sound/aoa/codecs/onyx.c                            |    3 +--
 sound/aoa/core/gpio-pmf.c                          |    9 +++------
 sound/core/control.c                               |    3 +--
 sound/core/pcm.c                                   |    3 +--
 sound/pci/ctxfi/ctdaio.c                           |    6 ++----
 sound/pci/emu10k1/emufx.c                          |    3 +--
 sound/pci/hda/hda_codec.c                          |    3 +--
 tools/perf/util/probe-event.c                      |   18 ++++++------------
 .../perf/util/scripting-engines/trace-event-perl.c |    3 +--
 .../util/scripting-engines/trace-event-python.c    |    3 +--
 tools/perf/util/thread.c                           |    6 ++----
 tools/perf/util/trace-event-parse.c                |    9 +++------
 usr/gen_init_cpio.c                                |    2 +-
 20 files changed, 31 insertions(+), 62 deletions(-)

diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 32d15bd..2c8796a 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -56,8 +56,7 @@ static inline void nf_ct_ext_destroy(struct nf_conn *ct)
  */
 static inline void nf_ct_ext_free(struct nf_conn *ct)
 {
-	if (ct->ext)
-		kfree(ct->ext);
+	kfree(ct->ext);
 }

 /* Add this type, returns pointer to data or NULL. */
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 10a6989..44fcc84 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -231,9 +231,7 @@ static void node_is_down(struct publication *publ)
 		    publ->type, publ->lower, publ->node, publ->ref, publ->key);
 	}

-	if (p) {
-		kfree(p);
-	}
+	kfree(p);
 }

 /**
diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c
index fe555e8..8373df0 100644
--- a/scripts/dtc/data.c
+++ b/scripts/dtc/data.c
@@ -32,8 +32,7 @@ void data_free(struct data d)
 		m = nm;
 	}

-	if (d.val)
-		free(d.val);
+	free(d.val);
 }

 struct data data_grow_for(struct data d, int xlen)
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.c_shipped
index 2ac23bc..571cabd 100644
--- a/scripts/genksyms/lex.c_shipped
+++ b/scripts/genksyms/lex.c_shipped
@@ -2311,8 +2311,7 @@ repeat:

       /* Save the filename and line number for later error messages.  */

-      if (cur_filename)
-	free(cur_filename);
+      free(cur_filename);

       file = strchr(yytext, '\"')+1;
       e = strchr(file, '\"');
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
index fe50ff9..b120089 100644
--- a/scripts/genksyms/lex.l
+++ b/scripts/genksyms/lex.l
@@ -151,8 +151,7 @@ repeat:

       /* Save the filename and line number for later error messages.  */

-      if (cur_filename)
-	free(cur_filename);
+      free(cur_filename);

       file = strchr(yytext, '\"')+1;
       e = strchr(file, '\"');
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c4dec80..884058d 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -206,8 +206,7 @@ load:
 		case S_INT:
 		case S_HEX:
 		case S_STRING:
-			if (sym->def[def].val)
-				free(sym->def[def].val);
+			free(sym->def[def].val);
 		default:
 			sym->def[def].val = NULL;
 			sym->def[def].tri = no;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index b6b2a46..87e2e96 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -94,8 +94,7 @@ struct gstr str_assign(const char *s)
 /* Free storage for growable string */
 void str_free(struct gstr *gs)
 {
-	if (gs->s)
-		free(gs->s);
+	free(gs->s);
 	gs->s = NULL;
 	gs->len = 0;
 }
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index 91852e4..ca7f9bc 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -1112,8 +1112,7 @@ static int onyx_i2c_remove(struct i2c_client *client)

 	aoa_codec_unregister(&onyx->codec);
 	of_node_put(onyx->codec.node);
-	if (onyx->codec_info)
-		kfree(onyx->codec_info);
+	kfree(onyx->codec_info);
 	i2c_set_clientdata(client, onyx);
 	kfree(onyx);
 	return 0;
diff --git a/sound/aoa/core/gpio-pmf.c b/sound/aoa/core/gpio-pmf.c
index 6776d1c..7e267c9 100644
--- a/sound/aoa/core/gpio-pmf.c
+++ b/sound/aoa/core/gpio-pmf.c
@@ -116,12 +116,9 @@ static void pmf_gpio_exit(struct gpio_runtime *rt)
 	mutex_destroy(&rt->line_in_notify.mutex);
 	mutex_destroy(&rt->line_out_notify.mutex);

-	if (rt->headphone_notify.gpio_private)
-		kfree(rt->headphone_notify.gpio_private);
-	if (rt->line_in_notify.gpio_private)
-		kfree(rt->line_in_notify.gpio_private);
-	if (rt->line_out_notify.gpio_private)
-		kfree(rt->line_out_notify.gpio_private);
+	kfree(rt->headphone_notify.gpio_private);
+	kfree(rt->line_in_notify.gpio_private);
+	kfree(rt->line_out_notify.gpio_private);
 }

 static void pmf_handle_notify_irq(void *data)
diff --git a/sound/core/control.c b/sound/core/control.c
index 439ce64..f66d924 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -942,8 +942,7 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol,
 static void snd_ctl_elem_user_free(struct snd_kcontrol *kcontrol)
 {
 	struct user_element *ue = kcontrol->private_data;
-	if (ue->tlv_data)
-		kfree(ue->tlv_data);
+	kfree(ue->tlv_data);
 	kfree(ue);
 }

diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 0d428d0..8708437 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -923,8 +923,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
 		       PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
 	kfree(runtime->hw_constraints.rules);
 #ifdef CONFIG_SND_PCM_XRUN_DEBUG
-	if (runtime->hwptr_log)
-		kfree(runtime->hwptr_log);
+	kfree(runtime->hwptr_log);
 #endif
 	kfree(runtime);
 	substream->runtime = NULL;
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c
index af56eb9..0bc1c8e 100644
--- a/sound/pci/ctxfi/ctdaio.c
+++ b/sound/pci/ctxfi/ctdaio.c
@@ -583,10 +583,8 @@ static int get_daio_rsc(struct daio_mgr *mgr,
 	return 0;

 error:
-	if (dao)
-		kfree(dao);
-	else if (dai)
-		kfree(dai);
+	kfree(dao);
+	kfree(dai);

 	spin_lock_irqsave(&mgr->mgr_lock, flags);
 	daio_mgr_put_rsc(&mgr->mgr, desc->type);
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 4b302d8..7b7e57b 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -768,8 +768,7 @@ static void snd_emu10k1_ctl_private_free(struct snd_kcontrol *kctl)
 	kctl->private_value = 0;
 	list_del(&ctl->list);
 	kfree(ctl);
-	if (kctl->tlv.p)
-		kfree(kctl->tlv.p);
+	kfree(kctl->tlv.p);
 }

 static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 0e76ac2..1a9e007 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -510,8 +510,7 @@ static int snd_hda_bus_free(struct hda_bus *bus)
 		return 0;
 	if (bus->workq)
 		flush_workqueue(bus->workq);
-	if (bus->unsol)
-		kfree(bus->unsol);
+	kfree(bus->unsol);
 	list_for_each_entry_safe(codec, n, &bus->codec_list, list) {
 		snd_hda_codec_free(codec);
 	}
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 7c004b6..0c1d2b4 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -460,20 +460,14 @@ static void clear_probe_point(struct probe_point *pp)
 {
 	int i;

-	if (pp->event)
-		free(pp->event);
-	if (pp->group)
-		free(pp->group);
-	if (pp->function)
-		free(pp->function);
-	if (pp->file)
-		free(pp->file);
-	if (pp->lazy_line)
-		free(pp->lazy_line);
+	free(pp->event);
+	free(pp->group);
+	free(pp->function);
+	free(pp->file);
+	free(pp->lazy_line);
 	for (i = 0; i < pp->nr_args; i++)
 		free(pp->args[i]);
-	if (pp->args)
-		free(pp->args);
+	free(pp->args);
 	for (i = 0; i < pp->found; i++)
 		free(pp->probes[i]);
 	memset(pp, 0, sizeof(*pp));
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 5376378..505df55 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -191,8 +191,7 @@ static void define_event_symbols(struct event *event,
 		zero_flag_atom = 0;
 		break;
 	case PRINT_FIELD:
-		if (cur_field_name)
-			free(cur_field_name);
+		free(cur_field_name);
 		cur_field_name = strdup(args->field.name);
 		break;
 	case PRINT_FLAGS:
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 6a72f14..6f9dfa3 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -148,8 +148,7 @@ static void define_event_symbols(struct event *event,
 		zero_flag_atom = 0;
 		break;
 	case PRINT_FIELD:
-		if (cur_field_name)
-			free(cur_field_name);
+		free(cur_field_name);
 		cur_field_name = strdup(args->field.name);
 		break;
 	case PRINT_FLAGS:
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index fa96831..0df4bc9 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -57,8 +57,7 @@ int thread__set_comm(struct thread *self, const char *comm)
 {
 	int err;

-	if (self->comm)
-		free(self->comm);
+	free(self->comm);
 	self->comm = strdup(comm);
 	err = self->comm == NULL ? -ENOMEM : 0;
 	if (!err) {
@@ -309,8 +308,7 @@ int thread__fork(struct thread *self, struct thread *parent)
 	int i;

 	if (parent->comm_set) {
-		if (self->comm)
-			free(self->comm);
+		free(self->comm);
 		self->comm = strdup(parent->comm);
 		if (!self->comm)
 			return -ENOMEM;
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 613c9cc..ec95eb6 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -384,8 +384,7 @@ static void free_arg(struct print_arg *arg)

 	switch (arg->type) {
 	case PRINT_ATOM:
-		if (arg->atom.atom)
-			free(arg->atom.atom);
+		free(arg->atom.atom);
 		break;
 	case PRINT_NULL:
 	case PRINT_FIELD ... PRINT_OP:
@@ -581,8 +580,7 @@ static enum event_type __read_token(char **tok)

 static void free_token(char *tok)
 {
-	if (tok)
-		free(tok);
+	free(tok);
 }

 static enum event_type read_token(char **tok)
@@ -969,8 +967,7 @@ static int event_read_fields(struct event *event, struct format_field **fields)
 fail:
 	free_token(token);
 fail_expect:
-	if (field)
-		free(field);
+	free(field);
 	return -1;
 }

diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index b2b3c2d..eb530b4 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -368,7 +368,7 @@ static int cpio_mkfile(const char *name, const char *location,
 	rc = 0;
 	
 error:
-	if (filebuf) free(filebuf);
+	free(filebuf);
 	if (file >= 0) close(file);
 	return rc;
 }
-- 
1.7.1.250.g7d1e8

