Skip to contentSkip to conversation

stagging: android: logger: code cleanup

PATCH In review Jerry Stralko 2 participants 2 messages Jun 22, 2014 – Jun 23, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stagging: android: logger: code cleanup

Add the unlikey macro to the return value of nonseekable_open, since it always returns successfully.

Fixed up some checkpatch warnings.

---
 drivers/staging/android/logger.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/android/logger.c +4 -5
index 2772e01..b98d181 100644
@@ -110,8 +110,8 @@ static inline struct logger_log *file_get_log(struct file *file)
 		struct logger_reader *reader = file->private_data;
 
 		return reader->log;
-	} else
-		return file->private_data;
+	}
+	return file->private_data;
 }
 
 /*
@@ -159,8 +159,7 @@ static size_t get_user_hdr_len(int ver)
 {
 	if (ver < 2)
 		return sizeof(struct user_logger_entry_compat);
-	else
-		return sizeof(struct logger_entry);
+	return sizeof(struct logger_entry);
 }
 
 static ssize_t copy_header_to_user(int ver, struct logger_entry *entry,
@@ -552,7 +551,7 @@ static int logger_open(struct inode *inode, struct file *file)
 	int ret;
 
 	ret = nonseekable_open(inode, file);
-	if (ret)
+	if (unlikely(ret))
 		return ret;
 
 	log = get_log_from_minor(MINOR(inode->i_rdev));
Signature · 1 line
1.9.3
#1 lore raw
Quoted 2 lines · Jerry Stralko

Add the unlikey macro to the return value of nonseekable_open, since it always returns successfully.

That shouldn't be needed, gcc and the processor knows this already. Don't use unusual unless you can measure it.

Quoted 1 line

Fixed up some checkpatch warnings.

Don't do more than one thing in a patch, please split this up.

greg k-h