hgbook

diff es/examples/data/remove-redundant-null-checks.patch @ 333:04c08ad7e92e

Translated svgs dummy .tex towards building
author Igor TAmara <igor@tamarapatino.org>
date Sat Oct 18 07:48:21 2008 -0500 (2008-10-18)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/es/examples/data/remove-redundant-null-checks.patch	Sat Oct 18 07:48:21 2008 -0500
     1.3 @@ -0,0 +1,190 @@
     1.4 +
     1.5 +From: Jesper Juhl <jesper.juhl@gmail.com>
     1.6 +
     1.7 +Remove redundant NULL chck before kfree + tiny CodingStyle cleanup for
     1.8 +drivers/
     1.9 +
    1.10 +Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
    1.11 +Signed-off-by: Andrew Morton <akpm@osdl.org>
    1.12 +---
    1.13 +
    1.14 + drivers/char/agp/sgi-agp.c        |    5 ++---
    1.15 + drivers/char/hvcs.c               |   11 +++++------
    1.16 + drivers/message/fusion/mptfc.c    |    6 ++----
    1.17 + drivers/message/fusion/mptsas.c   |    3 +--
    1.18 + drivers/net/fs_enet/fs_enet-mii.c |    3 +--
    1.19 + drivers/net/wireless/ipw2200.c    |   22 ++++++----------------
    1.20 + drivers/scsi/libata-scsi.c        |    4 +---
    1.21 + drivers/video/au1100fb.c          |    3 +--
    1.22 + 8 files changed, 19 insertions(+), 38 deletions(-)
    1.23 +
    1.24 +diff -puN drivers/char/agp/sgi-agp.c~remove-redundant-null-checks-before-free-in-drivers drivers/char/agp/sgi-agp.c
    1.25 +--- a/drivers/char/agp/sgi-agp.c~remove-redundant-null-checks-before-free-in-drivers
    1.26 ++++ a/drivers/char/agp/sgi-agp.c
    1.27 +@@ -329,9 +329,8 @@ static int __devinit agp_sgi_init(void)
    1.28 + 
    1.29 + static void __devexit agp_sgi_cleanup(void)
    1.30 + {
    1.31 +-	if (sgi_tioca_agp_bridges)
    1.32 +-		kfree(sgi_tioca_agp_bridges);
    1.33 +-	sgi_tioca_agp_bridges=NULL;
    1.34 ++	kfree(sgi_tioca_agp_bridges);
    1.35 ++	sgi_tioca_agp_bridges = NULL;
    1.36 + }
    1.37 + 
    1.38 + module_init(agp_sgi_init);
    1.39 +diff -puN drivers/char/hvcs.c~remove-redundant-null-checks-before-free-in-drivers drivers/char/hvcs.c
    1.40 +--- a/drivers/char/hvcs.c~remove-redundant-null-checks-before-free-in-drivers
    1.41 ++++ a/drivers/char/hvcs.c
    1.42 +@@ -1320,11 +1320,12 @@ static struct tty_operations hvcs_ops = 
    1.43 + static int hvcs_alloc_index_list(int n)
    1.44 + {
    1.45 + 	int i;
    1.46 ++
    1.47 + 	hvcs_index_list = kmalloc(n * sizeof(hvcs_index_count),GFP_KERNEL);
    1.48 + 	if (!hvcs_index_list)
    1.49 + 		return -ENOMEM;
    1.50 + 	hvcs_index_count = n;
    1.51 +-	for(i = 0; i < hvcs_index_count; i++)
    1.52 ++	for (i = 0; i < hvcs_index_count; i++)
    1.53 + 		hvcs_index_list[i] = -1;
    1.54 + 	return 0;
    1.55 + }
    1.56 +@@ -1332,11 +1333,9 @@ static int hvcs_alloc_index_list(int n)
    1.57 + static void hvcs_free_index_list(void)
    1.58 + {
    1.59 + 	/* Paranoia check to be thorough. */
    1.60 +-	if (hvcs_index_list) {
    1.61 +-		kfree(hvcs_index_list);
    1.62 +-		hvcs_index_list = NULL;
    1.63 +-		hvcs_index_count = 0;
    1.64 +-	}
    1.65 ++	kfree(hvcs_index_list);
    1.66 ++	hvcs_index_list = NULL;
    1.67 ++	hvcs_index_count = 0;
    1.68 + }
    1.69 + 
    1.70 + static int __init hvcs_module_init(void)
    1.71 +diff -puN drivers/message/fusion/mptfc.c~remove-redundant-null-checks-before-free-in-drivers drivers/message/fusion/mptfc.c
    1.72 +--- a/drivers/message/fusion/mptfc.c~remove-redundant-null-checks-before-free-in-drivers
    1.73 ++++ a/drivers/message/fusion/mptfc.c
    1.74 +@@ -305,10 +305,8 @@ mptfc_GetFcDevPage0(MPT_ADAPTER *ioc, in
    1.75 + 	}
    1.76 + 
    1.77 +  out:
    1.78 +-	if (pp0_array)
    1.79 +-		kfree(pp0_array);
    1.80 +-	if (p0_array)
    1.81 +-		kfree(p0_array);
    1.82 ++	kfree(pp0_array);
    1.83 ++	kfree(p0_array);
    1.84 + 	return rc;
    1.85 + }
    1.86 + 
    1.87 +diff -puN drivers/message/fusion/mptsas.c~remove-redundant-null-checks-before-free-in-drivers drivers/message/fusion/mptsas.c
    1.88 +--- a/drivers/message/fusion/mptsas.c~remove-redundant-null-checks-before-free-in-drivers
    1.89 ++++ a/drivers/message/fusion/mptsas.c
    1.90 +@@ -1378,8 +1378,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
    1.91 + 	return 0;
    1.92 + 
    1.93 +  out_free_port_info:
    1.94 +-	if (hba)
    1.95 +-		kfree(hba);
    1.96 ++	kfree(hba);
    1.97 +  out:
    1.98 + 	return error;
    1.99 + }
   1.100 +diff -puN drivers/net/fs_enet/fs_enet-mii.c~remove-redundant-null-checks-before-free-in-drivers drivers/net/fs_enet/fs_enet-mii.c
   1.101 +--- a/drivers/net/fs_enet/fs_enet-mii.c~remove-redundant-null-checks-before-free-in-drivers
   1.102 ++++ a/drivers/net/fs_enet/fs_enet-mii.c
   1.103 +@@ -431,8 +431,7 @@ static struct fs_enet_mii_bus *create_bu
   1.104 + 	return bus;
   1.105 + 
   1.106 + err:
   1.107 +-	if (bus)
   1.108 +-		kfree(bus);
   1.109 ++	kfree(bus);
   1.110 + 	return ERR_PTR(ret);
   1.111 + }
   1.112 + 
   1.113 +diff -puN drivers/net/wireless/ipw2200.c~remove-redundant-null-checks-before-free-in-drivers drivers/net/wireless/ipw2200.c
   1.114 +--- a/drivers/net/wireless/ipw2200.c~remove-redundant-null-checks-before-free-in-drivers
   1.115 ++++ a/drivers/net/wireless/ipw2200.c
   1.116 +@@ -1229,12 +1229,6 @@ static struct ipw_fw_error *ipw_alloc_er
   1.117 + 	return error;
   1.118 + }
   1.119 + 
   1.120 +-static void ipw_free_error_log(struct ipw_fw_error *error)
   1.121 +-{
   1.122 +-	if (error)
   1.123 +-		kfree(error);
   1.124 +-}
   1.125 +-
   1.126 + static ssize_t show_event_log(struct device *d,
   1.127 + 			      struct device_attribute *attr, char *buf)
   1.128 + {
   1.129 +@@ -1296,10 +1290,9 @@ static ssize_t clear_error(struct device
   1.130 + 			   const char *buf, size_t count)
   1.131 + {
   1.132 + 	struct ipw_priv *priv = dev_get_drvdata(d);
   1.133 +-	if (priv->error) {
   1.134 +-		ipw_free_error_log(priv->error);
   1.135 +-		priv->error = NULL;
   1.136 +-	}
   1.137 ++
   1.138 ++	kfree(priv->error);
   1.139 ++	priv->error = NULL;
   1.140 + 	return count;
   1.141 + }
   1.142 + 
   1.143 +@@ -1970,8 +1963,7 @@ static void ipw_irq_tasklet(struct ipw_p
   1.144 + 				struct ipw_fw_error *error =
   1.145 + 				    ipw_alloc_error_log(priv);
   1.146 + 				ipw_dump_error_log(priv, error);
   1.147 +-				if (error)
   1.148 +-					ipw_free_error_log(error);
   1.149 ++				kfree(error);
   1.150 + 			}
   1.151 + #endif
   1.152 + 		} else {
   1.153 +@@ -11693,10 +11685,8 @@ static void ipw_pci_remove(struct pci_de
   1.154 + 		}
   1.155 + 	}
   1.156 + 
   1.157 +-	if (priv->error) {
   1.158 +-		ipw_free_error_log(priv->error);
   1.159 +-		priv->error = NULL;
   1.160 +-	}
   1.161 ++	kfree(priv->error);
   1.162 ++	priv->error = NULL;
   1.163 + 
   1.164 + #ifdef CONFIG_IPW2200_PROMISCUOUS
   1.165 + 	ipw_prom_free(priv);
   1.166 +diff -puN drivers/scsi/libata-scsi.c~remove-redundant-null-checks-before-free-in-drivers drivers/scsi/libata-scsi.c
   1.167 +--- a/drivers/scsi/libata-scsi.c~remove-redundant-null-checks-before-free-in-drivers
   1.168 ++++ a/drivers/scsi/libata-scsi.c
   1.169 +@@ -222,9 +222,7 @@ int ata_cmd_ioctl(struct scsi_device *sc
   1.170 + 	 && copy_to_user(arg + sizeof(args), argbuf, argsize))
   1.171 + 		rc = -EFAULT;
   1.172 + error:
   1.173 +-	if (argbuf)
   1.174 +-		kfree(argbuf);
   1.175 +-
   1.176 ++	kfree(argbuf);
   1.177 + 	return rc;
   1.178 + }
   1.179 + 
   1.180 +diff -puN drivers/video/au1100fb.c~remove-redundant-null-checks-before-free-in-drivers drivers/video/au1100fb.c
   1.181 +--- a/drivers/video/au1100fb.c~remove-redundant-null-checks-before-free-in-drivers
   1.182 ++++ a/drivers/video/au1100fb.c
   1.183 +@@ -743,8 +743,7 @@ void __exit au1100fb_cleanup(void)
   1.184 + {
   1.185 + 	driver_unregister(&au1100fb_driver);
   1.186 + 
   1.187 +-	if (drv_info.opt_mode)
   1.188 +-		kfree(drv_info.opt_mode);
   1.189 ++	kfree(drv_info.opt_mode);
   1.190 + }
   1.191 + 
   1.192 + module_init(au1100fb_init);
   1.193 +_