Skip to contentSkip to conversation

staging: remove explicit intialization of static ints

PATCH New Supriya Karanth 1 participant 5 messages Mar 12, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover staging: remove explicit intialization of static ints

static integer variables are initialized to 0 by the compiler and it's not necessary to explicitly intialize them

This patchset removes the explicit intialization.

This issue was found by checkpatch.pl :
ERROR: do not initialise statics to 0 or NULL

These changes were made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

Supriya Karanth (4):
staging: i2o: remove intialization of static ints
staging: rtl8188eu: remove intialization of static ints
staging: rtl8723au: remove intialization of static ints
staging: sm750fb: remove intialization of static ints

 drivers/staging/i2o/i2o_block.c               | 2 +-
 drivers/staging/i2o/i2o_config.c              | 2 +-
 drivers/staging/i2o/iop.c                     | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   | 2 +-
 drivers/staging/rtl8723au/core/rtw_security.c | 2 +-
 drivers/staging/rtl8723au/os_dep/os_intfs.c   | 2 +-
 drivers/staging/sm750fb/sm750.c               | 6 +++---
 7 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/4 staging: i2o: remove intialization of static ints

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

---
 drivers/staging/i2o/i2o_block.c  | 2 +-
 drivers/staging/i2o/i2o_config.c | 2 +-
 drivers/staging/i2o/iop.c        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/i2o/i2o_block.c +1 -1
index 0a13c64..7784787 100644
@@ -1028,7 +1028,7 @@ static int i2o_block_probe(struct device *dev)
 	struct i2o_block_device *i2o_blk_dev;
 	struct gendisk *gd;
 	struct request_queue *queue;
-	static int unit = 0;
+	static int unit;
 	int rc;
 	u64 size;
 	u32 blocksize;
drivers/staging/i2o/i2o_config.c +1 -1
index 5748663..cd7ca5e 100644
@@ -64,7 +64,7 @@ struct i2o_cfg_info {
 	struct i2o_cfg_info *next;
 };
 static struct i2o_cfg_info *open_files = NULL;
-static ulong i2o_cfg_info_id = 0;
+static ulong i2o_cfg_info_id;
 
 static int i2o_cfg_getiops(unsigned long arg)
 {
drivers/staging/i2o/iop.c +1 -1
index 52334fc..6cae63c 100644
@@ -1042,7 +1042,7 @@ static void i2o_iop_release(struct device *dev)
  */
 struct i2o_controller *i2o_iop_alloc(void)
 {
-	static int unit = 0;	/* 0 and 1 are NULL IOP and Local Host */
+	static int unit;	/* 0 and 1 are NULL IOP and Local Host */
 	struct i2o_controller *c;
 	char poolname[32];
 
Signature · 1 line
2.1.0
#2 lore raw

PATCH 2/4 staging: rtl8188eu: remove intialization of static ints

In reply to Supriya Karanth

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

---
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/os_intfs.c +1 -1
index 88a909c..d762e25 100644
@@ -38,7 +38,7 @@ MODULE_VERSION(DRIVERVERSION);
 #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
 
 /* module param defaults */
-static int rtw_chip_version = 0x00;
+static int rtw_chip_version;
 static int rtw_rfintfs = HWPI;
 static int rtw_lbkmode;/* RTL8712_AIR_TRX; */
 static int rtw_network_mode = Ndis802_11IBSS;/* Ndis802_11Infrastructure; infra, ad-hoc, auto */
Signature · 1 line
2.1.0
#3 lore raw

PATCH 3/4 staging: rtl8723au: remove intialization of static ints

In reply to Supriya Karanth

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

---
 drivers/staging/rtl8723au/core/rtw_security.c | 2 +-
 drivers/staging/rtl8723au/os_dep/os_intfs.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723au/core/rtw_security.c +1 -1
index 0610d5f..045a24c 100644
@@ -87,7 +87,7 @@ static void arcfour_encrypt(	struct arc4context	*parc4ctx,
 
 }
 
-static int bcrc32initialized = 0;
+static int bcrc32initialized;
 static u32 crc32_table[256];
 
 static u8 crc32_reverseBit(u8 data)
drivers/staging/rtl8723au/os_dep/os_intfs.c +1 -1
index 1b23eb1..db6a1597 100644
@@ -34,7 +34,7 @@ MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin");
 MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin");
 
 /* module param defaults */
-static int rtw_chip_version = 0x00;
+static int rtw_chip_version;
 static int rtw_rfintfs = HWPI;
 static int rtw_debug = 1;
 
Signature · 1 line
2.1.0
#4 lore raw

PATCH 4/4 staging: sm750fb: remove intialization of static ints

In reply to Supriya Karanth

static ints are initialized to 0 by the compiler.
Explicit initialization is not necessary.

Found by checkpatch.pl - ERROR: do not initialise statics to 0 or NULL

changes made using coccinelle script:
@@
type T;
identifier var;
@@
static T var
- =0
;

---
 drivers/staging/sm750fb/sm750.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/sm750fb/sm750.c +3 -3
index aa0888c..343137f 100644
@@ -46,14 +46,14 @@ typedef int (*PROC_SPEC_INITHW)(struct lynx_share*,struct pci_dev*);
 
 /* common var for all device */
 static int g_hwcursor = 1;
-static int g_noaccel = 0;
+static int g_noaccel;
 #ifdef CONFIG_MTRR
-static int g_nomtrr  = 0;
+static int g_nomtrr;
 #endif
 static const char * g_fbmode[] = {NULL,NULL};
 static const char * g_def_fbmode = "800x600-16@60";
 static char * g_settings = NULL;
-static int g_dualview = 0;
+static int g_dualview;
 static char * g_option = NULL;
 
 /* if not use spin_lock,system will die if user load driver
Signature · 1 line
2.1.0