remove all useless-if-before-kfree tests, and those before free
Subsystems (50)
PATCH 1/1 remove all useless-if-before-kfree tests, and those before free
I've been using tools to automate the detection and removal of useless if-before-free tests for some time, and have applied them to numerous projects. Here's a sampling of those discussions, with justification:
http://thread.gmane.org/gmane.comp.version-control.git/74187
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/12712
http://thread.gmane.org/gmane.emacs.devel/98144
http://thread.gmane.org/gmane.comp.lib.glibc.alpha/13092
Quick summary:
This patch replaces code like this:
if (copy) kfree (copy);
with this:
kfree (copy);
The patch converts other variants, too, like "if (copy != NULL) ...". I've performed the conversion two ways: 1) fully mechanically using spatch,
2) mostly mechanically using gnulib's useless-if-before-free
http://git.sv.gnu.org/cgit/gnulib.git/tree/build-aux/useless-if-before-free
script to detect offenders, and the code in its comments to perform the conversions. Comparing the results shows nothing surprising, other than a couple of syntax errors introduced by spatch (from coccinelle-0.2.0-0.rc1.2.fc13.x86_64).
Here is how I used spatch:
---------------
git ls-files -z \
|xargs -0 ~/w/co/gnulib/build-aux/useless-if-before-free -l --name=kfree \
Quoted 1 line
knames
tr '\0' '\n' < knames > k; mv k knames
wc -l knames
131 knames
cat > if-before-kfree.cocci <<\EOF
@r@
expression E;
@@
- if (E != NULL) { kfree(E); }
+ kfree(E);
EOF
cat > if-before-free.cocci <<\EOF
@r@
expression E;
@@
- if (E != NULL) { free(E); }
+ free(E);
EOF
git ls-files -z \
|xargs -0 ~/w/co/gnulib/build-aux/useless-if-before-free -l > fnames
tr '\0' '\n' < fnames > k; mv k fnames
wc -l fnames
14 fnames
xargs spatch -inplace -linux_spacing -sp_file if-before-kfree.cocci < knames xargs spatch -inplace -linux_spacing -sp_file if-before-free.cocci < fnames
---------------
FYI, here are the diffs comparing the spatch-induced changes to the ones below:
http://meyering.net/code/spatch-vs-semiautomated--if-before-kfree.diff
If you're interested in keeping new useless-if tests from being introduced into the code, you may want to use code like this:
http://git.savannah.gnu.org/cgit/gnulib.git/tree/top/maint.mk#n252
--- arch/arm/mach-omap2/pm-debug.c | 3 +- arch/arm/oprofile/common.c | 3 +- arch/arm/plat-omap/mcbsp.c | 3 +- arch/um/kernel/skas/mmu.c | 3 +- crypto/ablkcipher.c | 3 +- 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 +- drivers/hid/hid-prodikeys.c | 3 +- drivers/hid/hid-zydacron.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 +- 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/net/wireless/orinoco/orinoco_usb.c | 3 +- drivers/rtc/rtc-m48t59.c | 3 +- drivers/s390/char/monreader.c | 3 +- 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/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/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/ti-st/bt_drv.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 +- 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 ++---- 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 +-- include/net/netfilter/nf_conntrack_extend.h | 3 +- net/caif/cfctrl.c | 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/core/control.c | 3 +- sound/core/pcm.c | 3 +- sound/pci/asihpi/hpifunc.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 | 54 +++++++------------- .../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 +- 131 files changed, 198 insertions(+), 402 deletions(-)
arch/arm/mach-omap2/pm-debug.c +1 -2
@@ -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 ; }
arch/arm/oprofile/common.c +1 -2
@@ -413,8 +413,7 @@ void oprofile_arch_exit(void) } } -if (counter_config) -kfree (counter_config); +kfree (counter_config); }#else int __init oprofile_arch_init (struct oprofile_operations *ops)
arch/arm/plat-omap/mcbsp.c +1 -2
@@ -854,8 +854,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);
arch/um/kernel/skas/mmu.c +1 -2
@@ -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);
crypto/ablkcipher.c +1 -2
@@ -141,8 +141,7 @@ err:if (walk->iv != req->info)memcpy (req->info, walk->iv, tfm->crt_ablkcipher.ivsize); -if (walk->iv_buffer) -kfree (walk->iv_buffer); +kfree (walk->iv_buffer);return err; }
drivers/acpi/processor_core.c +1 -2
@@ -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; }
drivers/ata/sata_fsl.c +1 -2
@@ -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; }
drivers/block/z2ram.c +1 -4
@@ -397,10 +397,7 @@ static void __exit z2_exit(void) } } -if ( z2ram_map !=NULL ) - { -kfree ( z2ram_map ); - } +kfree ( z2ram_map ); }return ;
drivers/char/hvc_iucv.c +1 -2
@@ -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; }
drivers/char/n_hdlc.c +8 -12
@@ -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);
drivers/char/pcmcia/ipwireless/hardware.c +1 -2
@@ -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) {
drivers/crypto/talitos.c +1 -2
@@ -2326,8 +2326,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);
drivers/gpu/drm/i915/intel_dvo.c +1 -2
@@ -283,8 +283,7 @@ static void intel_dvo_enc_destroy(struct drm_encoder *encoder)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); }if (intel_encoder->i2c_bus)intel_i2c_destroy (intel_encoder->i2c_bus);
drivers/gpu/drm/radeon/atom.c +1 -2
@@ -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); }
drivers/gpu/drm/radeon/radeon_connectors.c +2 -4
@@ -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);
drivers/gpu/drm/radeon/radeon_display.c +1 -3
@@ -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; }
drivers/hid/hid-prodikeys.c +1 -2
@@ -848,8 +848,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id) err_stop:hid_hw_stop (hdev); err_free: -if (pm !=NULL ) -kfree (pm); +kfree (pm);kfree (pk);return ret;
drivers/hid/hid-zydacron.c +1 -2
@@ -202,8 +202,7 @@ static void zc_remove(struct hid_device *hdev)hid_hw_stop (hdev); -if (NULL != zc) -kfree (zc); +kfree (zc); }static const struct hid_device_id zc_devices[] = {
drivers/media/dvb/dvb-usb/cinergyT2-fe.c +1 -2
@@ -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;
drivers/media/dvb/siano/smscoreapi.c +1 -2
@@ -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);
drivers/media/video/ivtv/ivtvfb.c +1 -2
@@ -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) {
drivers/message/fusion/mptfc.c +1 -2
@@ -526,8 +526,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 ; }
drivers/message/fusion/mptspi.c +1 -2
@@ -461,8 +461,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 ; }
drivers/misc/sgi-xp/xpc_partition.c +1 -2
@@ -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);
drivers/mmc/card/queue.c +5 -10
@@ -204,15 +204,12 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lockreturn 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 ;
drivers/mmc/core/bus.c +1 -2
@@ -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); }
drivers/mmc/core/sdio_bus.c +1 -2
@@ -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); }
drivers/mtd/chips/cfi_cmdset_0001.c +1 -2
@@ -2607,8 +2607,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); }
drivers/mtd/maps/ck804xrom.c +1 -2
@@ -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)) {
drivers/net/forcedeth.c +4 -8
@@ -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)
@@ -4465,10 +4463,8 @@ static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ripci_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; }
drivers/net/irda/kingsun-sir.c +2 -2
@@ -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;
drivers/net/ixgbe/ixgbe_main.c +1 -2
@@ -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 ;
drivers/net/myri10ge/myri10ge.c +1 -2
@@ -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);
drivers/net/netxen/netxen_nic_main.c +1 -2
@@ -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 ; }
drivers/net/ppp_mppe.c +2 -4
@@ -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)
drivers/net/qla3xxx.c +1 -1
@@ -2749,7 +2749,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,
drivers/net/qlcnic/qlcnic_main.c +1 -2
@@ -166,8 +166,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 ; }
drivers/net/stmmac/stmmac_main.c +1 -2
@@ -921,8 +921,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);
drivers/net/usb/hso.c +1 -2
@@ -2821,8 +2821,7 @@ exit:tty_unregister_device (tty_drv, serial->minor);kfree (serial); } -if (hso_dev) -kfree (hso_dev); +kfree (hso_dev);return NULL ; }
drivers/net/wireless/ath/ath5k/attach.c +1 -2
@@ -355,8 +355,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);
drivers/net/wireless/ipw2x00/libipw_module.c +1 -2
@@ -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]); } }
drivers/net/wireless/orinoco/orinoco_usb.c +1 -2
@@ -1510,8 +1510,7 @@ static inline void ezusb_delete(struct ezusb_priv *upriv)mutex_unlock (&upriv->mtx);kfree (upriv->read_urb->transfer_buffer); -if (upriv->bap_buf !=NULL ) -kfree (upriv->bap_buf); +kfree (upriv->bap_buf);if (upriv->read_urb !=NULL )usb_free_urb (upriv->read_urb);if (upriv->dev) {
drivers/rtc/rtc-m48t59.c +1 -2
@@ -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; }
drivers/s390/char/monreader.c +1 -2
@@ -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); }
drivers/scsi/aic7xxx/aicasm/aicasm_scan.l +1 -2
@@ -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) {
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c +4 -8
@@ -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 :
drivers/scsi/aic94xx/aic94xx_init.c +1 -2
@@ -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++) {
drivers/scsi/lpfc/lpfc_bsg.c +1 -2
@@ -1070,8 +1070,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;
drivers/staging/comedi/drivers/cb_das16_cs.c +1 -2
@@ -719,8 +719,7 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) ((struct local_info_t *)link->priv)->stop =1 ;das16cs_pcmcia_release (link);/* This points to the parent struct local_info_t struct */ -if (link->priv) -kfree (link->priv); +kfree (link->priv); }/* das16cs_pcmcia_detach */
drivers/staging/comedi/drivers/das08_cs.c +1 -2
@@ -206,8 +206,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *link)das08_pcmcia_release (link);/* This points to the parent struct local_info_t struct */ -if (link->priv) -kfree (link->priv); +kfree (link->priv); }/* das08_pcmcia_detach */
drivers/staging/comedi/drivers/das16.c +2 -4
@@ -1695,10 +1695,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)
drivers/staging/comedi/drivers/ni_at_a2150.c +1 -2
@@ -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 ;
drivers/staging/comedi/drivers/ni_daq_700.c +1 -2
@@ -537,8 +537,7 @@ static void dio700_cs_detach(struct pcmcia_device *link)dio700_release (link);/* This points to the parent struct local_info_t struct */ -if (link->priv) -kfree (link->priv); +kfree (link->priv); }/* dio700_cs_detach */
drivers/staging/comedi/drivers/ni_daq_dio24.c +1 -2
@@ -289,8 +289,7 @@ static void dio24_cs_detach(struct pcmcia_device *link)dio24_release (link);/* This points to the parent local_info_t struct */ -if (link->priv) -kfree (link->priv); +kfree (link->priv); }/* dio24_cs_detach */
drivers/staging/comedi/drivers/ni_labpc.c +1 -2
@@ -790,8 +790,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)
drivers/staging/comedi/drivers/quatech_daqp_cs.c +1 -2
@@ -1076,8 +1076,7 @@ static void daqp_cs_detach(struct pcmcia_device *link)/* Unlink device structure, and free it */ dev_table[dev->table_index] =NULL ; -if (dev) -kfree (dev); +kfree (dev); }/* daqp_cs_detach */
drivers/staging/comedi/drivers/serial2002.c +4 -12
@@ -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 ; }
drivers/staging/crystalhd/crystalhd_lnx.c +1 -2
@@ -435,8 +435,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);
drivers/staging/cx25821/cx25821-audio-upstream.c +1 -2
@@ -248,8 +248,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)
drivers/staging/cx25821/cx25821-video-upstream-ch2.c +1 -2
@@ -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 );
drivers/staging/cx25821/cx25821-video-upstream.c +1 -2
@@ -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 );
drivers/staging/dream/camera/msm_vfe7x.c +1 -2
@@ -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);
drivers/staging/go7007/go7007-usb.c +2 -4
@@ -1247,15 +1247,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); } }
drivers/staging/pohmelfs/config.c +2 -4
@@ -603,11 +603,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); }
drivers/staging/rt2860/common/spectrum.c +2 -4
@@ -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 ;
drivers/staging/rt2860/rt_linux.c +2 -4
@@ -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 )
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c +1 -2
@@ -2604,8 +2604,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); }
drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c +0 -1
@@ -735,7 +735,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 ;
drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c +0 -1
@@ -987,7 +987,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 ;
drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c +0 -1
@@ -775,7 +775,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 ;
drivers/staging/rtl8192u/ieee80211/cipher.c +1 -2
@@ -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); }
drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +0 -1
@@ -855,7 +855,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 ;
drivers/staging/rtl8192u/r8192U_core.c +2 -6
@@ -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 ;
drivers/staging/serqt_usb2/serqt_usb2.c +1 -2
@@ -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); }
drivers/staging/ti-st/bt_drv.c +1 -2
@@ -376,8 +376,7 @@ static void hci_st_destruct(struct hci_dev *hdev)BT_DRV_DBG ("%s" , hdev->name);/* free hci_st memory */ -if (hdev->driver_data !=NULL ) -kfree (hdev->driver_data); +kfree (hdev->driver_data);BTDRV_API_EXIT (0 );return ;
drivers/staging/usbip/stub_main.c +2 -4
@@ -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); }
drivers/staging/vme/bridges/vme_ca91cx42.c +1 -2
@@ -516,8 +516,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 )); }
drivers/staging/vme/bridges/vme_tsi148.c +1 -2
@@ -817,8 +817,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 )); }
drivers/staging/vt6655/device_main.c +1 -2
@@ -3059,8 +3059,7 @@ else { } error1: -if (buffer) -kfree (buffer); +kfree (buffer);if (filp_close (filp,NULL ))printk ("Config_FileOperation:close file fail\n" );
drivers/staging/vt6655/hostap.c +1 -2
@@ -860,8 +860,7 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) } out: -if (param !=NULL ) -kfree (param); +kfree (param);return ret; }
drivers/staging/vt6655/wpactl.c +1 -2
@@ -982,8 +982,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) } out: -if (param !=NULL ) -kfree (param); +kfree (param);return ret; }
drivers/staging/vt6656/firmware.c +2 -4
@@ -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);
drivers/staging/vt6656/hostap.c +1 -2
@@ -858,8 +858,7 @@ int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p) } out: -if (param !=NULL ) -kfree (param); +kfree (param);return ret; }
drivers/staging/vt6656/main_usb.c +4 -8
@@ -858,8 +858,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 ; }
@@ -882,8 +881,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 ; }
@@ -900,8 +898,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 ; }
@@ -1542,8 +1539,7 @@ error2:*/ if (result!=0 ) { -if (buffer) -kfree (buffer); +kfree (buffer); buffer=NULL ; }return buffer;
drivers/staging/vt6656/wpactl.c +1 -2
@@ -1003,8 +1003,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) } out: -if (param !=NULL ) -kfree (param); +kfree (param);return ret; }
drivers/staging/winbond/wb35reg.c +1 -2
@@ -67,8 +67,7 @@ unsigned char Wb35Reg_BurstWrite(struct hw_data *pHwData, u16 RegisterNo, u32 *p }else {if (urb)usb_free_urb (urb); -if (reg_queue) -kfree (reg_queue); +kfree (reg_queue);return false; }return false;
drivers/staging/wlan-ng/prism2fw.c +1 -2
@@ -444,8 +444,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));
drivers/usb/serial/mos7840.c +2 -5
@@ -1215,9 +1215,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]); }
@@ -1254,8 +1252,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); }
drivers/uwb/wlp/wlp-lc.c +1 -2
@@ -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 ; }
drivers/video/au1200fb.c +2 -4
@@ -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);
drivers/video/console/softcursor.c +1 -2
@@ -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 );
drivers/video/uvesafb.c +6 -12
@@ -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);
fs/btrfs/free-space-cache.c +2 -4
@@ -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);
fs/ceph/crush/crush.c +1 -1
@@ -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
fs/dlm/memory.c +1 -2
@@ -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); } }
fs/ecryptfs/keystore.c +1 -2
@@ -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; }
fs/ecryptfs/messaging.c +2 -4
@@ -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);
fs/jffs2/acl.c +1 -2
@@ -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;
fs/jffs2/scan.c +1 -2
@@ -272,8 +272,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; }
fs/jffs2/xattr.c +1 -2
@@ -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); } }
fs/nfs/nfs4proc.c +1 -2
@@ -2260,8 +2260,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; }
fs/ocfs2/alloc.c +1 -2
@@ -6778,8 +6778,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; }
fs/ocfs2/cluster/heartbeat.c +2 -4
@@ -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 (®->hr_all_item);
fs/ocfs2/cluster/tcp.c +2 -4
@@ -1083,10 +1083,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; }
fs/ocfs2/dlm/dlmdomain.c +1 -2
@@ -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); }
fs/ocfs2/dlm/dlmrecovery.c +2 -4
@@ -1492,10 +1492,8 @@ leave:dlm_put (dlm);if (ret <0 ) { -if (buf) -kfree (buf); -if (item) -kfree (item); +kfree (buf); +kfree (item); }mlog_exit (ret);
fs/ocfs2/extent_map.c +1 -2
@@ -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,
fs/ocfs2/journal.c +3 -6
@@ -1276,11 +1276,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);
@@ -1452,8 +1450,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
fs/ocfs2/localalloc.c +2 -4
@@ -473,8 +473,7 @@ out:if (local_alloc_inode)iput (local_alloc_inode); -if (alloc_copy) -kfree (alloc_copy); +kfree (alloc_copy);mlog_exit_void (); }
@@ -1311,8 +1310,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);
fs/ocfs2/super.c +2 -4
@@ -2451,8 +2451,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;
@@ -2480,8 +2479,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 ));
include/net/netfilter/nf_conntrack_extend.h +1 -2
@@ -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. */
net/caif/cfctrl.c +1 -2
@@ -587,8 +587,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt) client_layer : NULL); } -if (req !=NULL ) -kfree (req); +kfree (req); }break ;case CFCTRL_CMD_LINK_DESTROY :
net/tipc/name_distr.c +1 -3
@@ -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); }/**
scripts/dtc/data.c +1 -2
@@ -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)
scripts/genksyms/lex.c_shipped +1 -2
@@ -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, '\"');
scripts/genksyms/lex.l +1 -2
@@ -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, '\"');
scripts/kconfig/confdata.c +1 -2
@@ -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;
scripts/kconfig/util.c +1 -2
@@ -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 ; }
sound/aoa/codecs/onyx.c +1 -2
@@ -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 ;
sound/core/control.c +1 -2
@@ -946,8 +946,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); }
sound/core/pcm.c +1 -2
@@ -920,8 +920,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 ;
sound/pci/asihpi/hpifunc.c +1 -2
@@ -3266,8 +3266,7 @@ u16 hpi_entity_find_next(struct hpi_entity *container_entity,void hpi_entity_free (struct hpi_entity *entity) { -if (entity !=NULL ) -kfree (entity); +kfree (entity); } static u16 hpi_entity_alloc_and_copy(struct hpi_entity *src,
sound/pci/ctxfi/ctdaio.c +2 -4
@@ -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);
sound/pci/emu10k1/emufx.c +1 -2
@@ -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,
sound/pci/hda/hda_codec.c +1 -2
@@ -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); }
tools/perf/util/probe-event.c +18 -36
87 lines not on this page · raw message
tools/perf/util/scripting-engines/trace-event-perl.c +1 -2
@@ -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 :
tools/perf/util/scripting-engines/trace-event-python.c +1 -2
@@ -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 :
tools/perf/util/thread.c +2 -4
@@ -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) {
@@ -135,8 +134,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 ;
tools/perf/util/trace-event-parse.c +3 -6
@@ -386,8 +386,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:
@@ -583,8 +582,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)
@@ -981,8 +979,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 ; }
usr/gen_init_cpio.c +1 -1
@@ -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; }
Signature · 1 line
1.7.1.342.g1c280