diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index c100e0f..aef84ac 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -23,19 +23,20 @@
 #include "xregex.h"
 
 #define DEV_PATH	"/dev"
+#define MDEV_CONF	"/etc/mdev.conf"
 
 #include <busybox.h>
 
 /* mknod in /dev based on a path like "/sys/block/hda/hda1" */
 static void make_device(char *path)
 {
-	char *device_name,*s;
-	int major,minor,type,len,fd;
-	int mode=0660;
-	uid_t uid=0;
-	gid_t gid=0;
+	char *device_name, *s;
+	int major, minor, type, len, fd;
+	int mode = 0660;
+	uid_t uid = 0;
+	gid_t gid = 0;
 
-	RESERVE_CONFIG_BUFFER(temp,PATH_MAX);
+	RESERVE_CONFIG_BUFFER(temp, PATH_MAX);
 
 	/* Try to read major/minor string */
 
@@ -43,60 +44,64 @@
 	fd = open(temp, O_RDONLY);
 	len = read(fd, temp, PATH_MAX-1);
 	close(fd);
-	if (len<1) goto end;
+	if (len < 1) goto end;
 
 	/* Determine device name, type, major and minor */
 
 	device_name = strrchr(path, '/') + 1;
-	type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK;
-	if(sscanf(temp, "%d:%d", &major, &minor) != 2) goto end;
+	type = strncmp(path+5, "block/", 6) ? S_IFCHR : S_IFBLK;
+	if (sscanf(temp, "%d:%d", &major, &minor) != 2)
+		goto end;
 
 	/* If we have a config file, look up permissions for this device */
 
 	if (ENABLE_FEATURE_MDEV_CONF) {
-		char *conf,*pos,*end;
+		char *conf, *pos, *end;
 
 		/* mmap the config file */
-		if (-1!=(fd=open("/etc/mdev.conf",O_RDONLY))) {
-			len=lseek(fd,0,SEEK_END);
-			conf=mmap(NULL,len,PROT_READ,MAP_PRIVATE,fd,0);
+		if (-1 != (fd=open(MDEV_CONF,O_RDONLY))) {
+			len = lseek(fd, 0, SEEK_END);
+			conf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
 			if (conf) {
-				int line=0;
+				int line = 0;
 
 				/* Loop through lines in mmaped file*/
-				for (pos=conf;pos-conf<len;) {
+				for (pos=conf; pos-conf<len;) {
 					int field;
 					char *end2;
 
 					line++;
 					/* find end of this line */
-					for(end=pos;end-conf<len && *end!='\n';end++);
+					for(end=pos; end-conf<len && *end!='\n'; end++)
+						;
 
 					/* Three fields: regex, uid:gid, mode */
-					for (field=3;field;field--) {
+					for (field=3; field; field--) {
 						/* Skip whitespace */
-						while (pos<end && isspace(*pos)) pos++;
-						if (pos==end || *pos=='#') break;
-						for (end2=pos;
-							end2<end && !isspace(*end2) && *end2!='#'; end2++);
-						switch(field) {
+						while (pos<end && isspace(*pos))
+							pos++;
+						if (pos==end || *pos=='#')
+							break;
+						for (end2=pos; end2<end && !isspace(*end2) && *end2!='#'; end2++)
+							;
+
+						switch (field) {
 							/* Regex to match this device */
 							case 3:
 							{
-								char *regex=strndupa(pos,end2-pos);
+								char *regex = strndupa(pos,end2-pos);
 								regex_t match;
 								regmatch_t off;
 								int result;
 
 								/* Is this it? */
 								xregcomp(&match,regex,REG_EXTENDED);
-								result=regexec(&match,device_name,1,&off,0);
+								result = regexec(&match,device_name,1,&off,0);
 								regfree(&match);
 
 								/* If not this device, skip rest of line */
-								if(result || off.rm_so
-									|| off.rm_eo!=strlen(device_name))
-										goto end_line;
+								if (result || off.rm_so || off.rm_eo!=strlen(device_name))
+									goto end_line;
 
 								break;
 							}
@@ -106,48 +111,54 @@
 								char *s2;
 
 								/* Find : */
-								for(s=pos;s<end2 && *s!=':';s++);
-								if(s==end2) goto end_line;
+								for(s=pos; s<end2 && *s!=':'; s++)
+									;
+								if (s == end2)
+									goto end_line;
 
 								/* Parse UID */
-								uid=strtoul(pos,&s2,10);
-								if(s!=s2) {
+								uid = strtoul(pos,&s2,10);
+								if (s != s2) {
 									struct passwd *pass;
-									pass=getpwnam(strndupa(pos,s-pos));
-									if(!pass) goto end_line;
-									uid=pass->pw_uid;
+									pass = getpwnam(strndupa(pos,s-pos));
+									if (!pass)
+										goto end_line;
+									uid = pass->pw_uid;
 								}
 								s++;
 								/* parse GID */
-								gid=strtoul(s,&s2,10);
-								if(end2!=s2) {
+								gid = strtoul(s,&s2,10);
+								if (end2 != s2) {
 									struct group *grp;
-									grp=getgrnam(strndupa(s,end2-s));
-									if(!grp) goto end_line;
-									gid=grp->gr_gid;
+									grp = getgrnam(strndupa(s,end2-s));
+									if (!grp)
+										goto end_line;
+									gid = grp->gr_gid;
 								}
 								break;
 							}
 							/* mode */
 							case 1:
 							{
-								mode=strtoul(pos,&pos,8);
-								if(pos!=end2) goto end_line;
-								goto found_device;
+								mode = strtoul(pos,&pos,8);
+								if (pos != end2)
+									goto end_line;
+								else
+									goto found_device;
 							}
 						}
-						pos=end2;
+						pos = end2;
 					}
 end_line:
 					/* Did everything parse happily? */
 					if (field && field!=3)
-							bb_error_msg_and_die("Bad line %d",line);
+						bb_error_msg_and_die("Bad line %d",line);
 
 					/* Next line */
-					pos=++end;
+					pos = ++end;
 				}
 found_device:
-				munmap(conf,len);
+				munmap(conf, len);
 			}
 			close(fd);
 		}
@@ -170,7 +181,7 @@
 static void find_dev(char *path)
 {
 	DIR *dir;
-	size_t len=strlen(path);
+	size_t len = strlen(path);
 	struct dirent *entry;
 
 	if ((dir = opendir(path)) == NULL)
@@ -180,7 +191,8 @@
 
 		/* Skip "." and ".." (also skips hidden files, which is ok) */
 
-		if (entry->d_name[0]=='.') continue;
+		if (entry->d_name[0] == '.')
+			continue;
 
 		if (entry->d_type == DT_DIR) {
 			snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
@@ -214,7 +226,8 @@
 	} else {
 		action = getenv("ACTION");
 		env_path = getenv("DEVPATH");
-	    if (!action || !env_path) bb_show_usage();
+	    if (!action || !env_path)
+			bb_show_usage();
 
 		if (!strcmp(action, "add")) {
 			sprintf(temp, "/sys%s", env_path);
@@ -225,6 +238,6 @@
 		}
 	}
 
-	if(ENABLE_FEATURE_CLEAN_UP) RELEASE_CONFIG_BUFFER(temp);
+	if (ENABLE_FEATURE_CLEAN_UP) RELEASE_CONFIG_BUFFER(temp);
 	return 0;
 }
