public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] yaffs2: fix clang warnings and small cleanup
@ 2014-06-21 18:58 Jeroen Hofstee
  2014-06-21 18:58 ` [U-Boot] [PATCH 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jeroen Hofstee @ 2014-06-21 18:58 UTC (permalink / raw)
  To: u-boot

ignores checkpatch warning:

CHECK: if this code is redundant consider removing it
#120: FILE: fs/yaffs2/yaffsfs.c:3186:
+#if 0

since this was already in u-boot.

Jeroen Hofstee (2):
  yaffs2: cosmetic: remove self assignments
  yaffs2: preprocessor cleanup

 fs/yaffs2/yaffs_guts.c   | 32 ++++++++++----------------------
 fs/yaffs2/yaffs_verify.c |  4 ----
 fs/yaffs2/yaffsfs.c      |  8 +-------
 3 files changed, 11 insertions(+), 33 deletions(-)

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/2] yaffs2: cosmetic: remove self assignments
  2014-06-21 18:58 [U-Boot] [PATCH 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
@ 2014-06-21 18:58 ` Jeroen Hofstee
  2014-06-21 18:58 ` [U-Boot] [PATCH 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
  2014-07-12 13:16 ` [U-Boot] [PATCH v2 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
  2 siblings, 0 replies; 9+ messages in thread
From: Jeroen Hofstee @ 2014-06-21 18:58 UTC (permalink / raw)
  To: u-boot

Remove self assignments which is just dead code to prevent
compiler warnings about non used arguments. For u-boot this
does not prevent any warning though, on the contrary it actual
introduces warnings when compiling with clang. Remove them.

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 fs/yaffs2/yaffs_guts.c   | 11 -----------
 fs/yaffs2/yaffs_verify.c |  4 ----
 fs/yaffs2/yaffsfs.c      |  8 +-------
 3 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index 21441fd..1fa5910 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -219,18 +219,11 @@ static void yaffs_handle_chunk_wr_ok(struct yaffs_dev *dev, int nand_chunk,
 				     const u8 *data,
 				     const struct yaffs_ext_tags *tags)
 {
-	dev = dev;
-	nand_chunk = nand_chunk;
-	data = data;
-	tags = tags;
 }
 
 static void yaffs_handle_chunk_update(struct yaffs_dev *dev, int nand_chunk,
 				      const struct yaffs_ext_tags *tags)
 {
-	dev = dev;
-	nand_chunk = nand_chunk;
-	tags = tags;
 }
 
 void yaffs_handle_chunk_error(struct yaffs_dev *dev,
@@ -814,8 +807,6 @@ struct yaffs_tnode *yaffs_find_tnode_0(struct yaffs_dev *dev,
 	int required_depth;
 	int level = file_struct->top_level;
 
-	dev = dev;
-
 	/* Check sane level and chunk Id */
 	if (level < 0 || level > YAFFS_TNODES_MAX_LEVEL)
 		return NULL;
@@ -3214,7 +3205,6 @@ static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
 		}
 	} else {
 #else
-	dev = dev;
 	{
 #endif
 		yaffs_strncpy(name, oh_name, buff_size - 1);
@@ -3258,7 +3248,6 @@ static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
 		}
 	} else {
 #else
-	dev = dev;
 	{
 #endif
 		yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
diff --git a/fs/yaffs2/yaffs_verify.c b/fs/yaffs2/yaffs_verify.c
index 97734a9..3fef28b 100644
--- a/fs/yaffs2/yaffs_verify.c
+++ b/fs/yaffs2/yaffs_verify.c
@@ -19,20 +19,17 @@
 
 int yaffs_skip_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask &
 		 (YAFFS_TRACE_VERIFY | YAFFS_TRACE_VERIFY_FULL));
 }
 
 static int yaffs_skip_full_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask & (YAFFS_TRACE_VERIFY_FULL));
 }
 
 static int yaffs_skip_nand_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask & (YAFFS_TRACE_VERIFY_NAND));
 }
 
@@ -521,6 +518,5 @@ void yaffs_verify_free_chunks(struct yaffs_dev *dev)
 
 int yaffs_verify_file_sane(struct yaffs_obj *in)
 {
-	in = in;
 	return YAFFS_OK;
 }
diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c
index 334598e..41e5f01 100644
--- a/fs/yaffs2/yaffsfs.c
+++ b/fs/yaffs2/yaffsfs.c
@@ -3136,10 +3136,6 @@ int yaffs_link(const YCHAR *oldpath, const YCHAR *linkpath)
 
 int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev)
 {
-	pathname = pathname;
-	mode = mode;
-	dev = dev;
-
 	yaffsfs_SetError(-EINVAL);
 	return -1;
 }
@@ -3187,9 +3183,7 @@ int yaffs_set_error(int error)
 
 int yaffs_dump_dev(const YCHAR *path)
 {
-#if 1
-	path = path;
-#else
+#if 0
 	YCHAR *rest;
 
 	struct yaffs_obj *obj = yaffsfs_FindRoot(path, &rest);
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/2] yaffs2: preprocessor cleanup
  2014-06-21 18:58 [U-Boot] [PATCH 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
  2014-06-21 18:58 ` [U-Boot] [PATCH 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
@ 2014-06-21 18:58 ` Jeroen Hofstee
  2014-06-21 19:04   ` Jeroen Hofstee
  2014-07-12 13:16 ` [U-Boot] [PATCH v2 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
  2 siblings, 1 reply; 9+ messages in thread
From: Jeroen Hofstee @ 2014-06-21 18:58 UTC (permalink / raw)
  To: u-boot

Current code uses the preprocessor to and else case
to an statement without an if condition at all. Although
this works, change the optional code to return early, so
it is contained within the #ifdef.

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 fs/yaffs2/yaffs_guts.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index 1fa5910..32e6ff2 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -3203,19 +3203,18 @@ static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
 		} else {
 			yaffs_strncpy(name, oh_name + 1, buff_size - 1);
 		}
-	} else {
-#else
-	{
-#endif
-		yaffs_strncpy(name, oh_name, buff_size - 1);
+
+		return;
 	}
+#endif
+
+	yaffs_strncpy(name, oh_name, buff_size - 1);
 }
 
 static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
 				    const YCHAR *name)
 {
 #ifdef CONFIG_YAFFS_AUTO_UNICODE
-
 	int is_ascii;
 	YCHAR *w;
 
@@ -3246,12 +3245,12 @@ static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
 			*oh_name = 0;
 			yaffs_strncpy(oh_name + 1, name, YAFFS_MAX_NAME_LENGTH - 2);
 		}
-	} else {
-#else
-	{
-#endif
-		yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
+
+		return;
 	}
+#endif
+
+	yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
 }
 
 /* UpdateObjectHeader updates the header on NAND for an object.
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/2] yaffs2: preprocessor cleanup
  2014-06-21 18:58 ` [U-Boot] [PATCH 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
@ 2014-06-21 19:04   ` Jeroen Hofstee
  0 siblings, 0 replies; 9+ messages in thread
From: Jeroen Hofstee @ 2014-06-21 19:04 UTC (permalink / raw)
  To: u-boot

On za, 2014-06-21 at 20:58 +0200, Jeroen Hofstee wrote:
> Current code uses the preprocessor to and else case
> to an statement without an if condition at all. Although
> this works, change the optional code to return early, so
> it is contained within the #ifdef.
> 
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
> ---

Attempt 2:

    Current code uses the preprocessor to change an else case
    to a statement without any if condition at all. Although
    this works, change the optional code to return early, so
    all optional code is contained within a single #ifdef.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 0/2] yaffs2: fix clang warnings and small cleanup
  2014-06-21 18:58 [U-Boot] [PATCH 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
  2014-06-21 18:58 ` [U-Boot] [PATCH 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
  2014-06-21 18:58 ` [U-Boot] [PATCH 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
@ 2014-07-12 13:16 ` Jeroen Hofstee
  2014-07-12 13:16   ` [U-Boot] [PATCH v2 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
  2014-07-12 13:16   ` [U-Boot] [PATCH v2 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
  2 siblings, 2 replies; 9+ messages in thread
From: Jeroen Hofstee @ 2014-07-12 13:16 UTC (permalink / raw)
  To: u-boot

ignores checkpatch warning:

CHECK: if this code is redundant consider removing it
#120: FILE: fs/yaffs2/yaffsfs.c:3186:
+#if 0

since this was already in u-boot.

changes since v1:
  fix some typos in the commit message

Jeroen Hofstee (2):
  yaffs2: cosmetic: remove self assignments
  yaffs2: preprocessor cleanup

 fs/yaffs2/yaffs_guts.c   | 32 ++++++++++----------------------
 fs/yaffs2/yaffs_verify.c |  4 ----
 fs/yaffs2/yaffsfs.c      |  8 +-------
 3 files changed, 11 insertions(+), 33 deletions(-)

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 1/2] yaffs2: cosmetic: remove self assignments
  2014-07-12 13:16 ` [U-Boot] [PATCH v2 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
@ 2014-07-12 13:16   ` Jeroen Hofstee
  2014-07-21 20:43     ` [U-Boot] [U-Boot, v2, " Tom Rini
  2014-07-12 13:16   ` [U-Boot] [PATCH v2 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
  1 sibling, 1 reply; 9+ messages in thread
From: Jeroen Hofstee @ 2014-07-12 13:16 UTC (permalink / raw)
  To: u-boot

Remove self assignments which is just dead code to prevent
compiler warnings about non used arguments. For u-boot this
does not prevent any warning though, on the contrary it actual
introduces warnings when compiling with clang. Remove them.

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 fs/yaffs2/yaffs_guts.c   | 11 -----------
 fs/yaffs2/yaffs_verify.c |  4 ----
 fs/yaffs2/yaffsfs.c      |  8 +-------
 3 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index 21441fd..1fa5910 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -219,18 +219,11 @@ static void yaffs_handle_chunk_wr_ok(struct yaffs_dev *dev, int nand_chunk,
 				     const u8 *data,
 				     const struct yaffs_ext_tags *tags)
 {
-	dev = dev;
-	nand_chunk = nand_chunk;
-	data = data;
-	tags = tags;
 }
 
 static void yaffs_handle_chunk_update(struct yaffs_dev *dev, int nand_chunk,
 				      const struct yaffs_ext_tags *tags)
 {
-	dev = dev;
-	nand_chunk = nand_chunk;
-	tags = tags;
 }
 
 void yaffs_handle_chunk_error(struct yaffs_dev *dev,
@@ -814,8 +807,6 @@ struct yaffs_tnode *yaffs_find_tnode_0(struct yaffs_dev *dev,
 	int required_depth;
 	int level = file_struct->top_level;
 
-	dev = dev;
-
 	/* Check sane level and chunk Id */
 	if (level < 0 || level > YAFFS_TNODES_MAX_LEVEL)
 		return NULL;
@@ -3214,7 +3205,6 @@ static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
 		}
 	} else {
 #else
-	dev = dev;
 	{
 #endif
 		yaffs_strncpy(name, oh_name, buff_size - 1);
@@ -3258,7 +3248,6 @@ static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
 		}
 	} else {
 #else
-	dev = dev;
 	{
 #endif
 		yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
diff --git a/fs/yaffs2/yaffs_verify.c b/fs/yaffs2/yaffs_verify.c
index 97734a9..3fef28b 100644
--- a/fs/yaffs2/yaffs_verify.c
+++ b/fs/yaffs2/yaffs_verify.c
@@ -19,20 +19,17 @@
 
 int yaffs_skip_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask &
 		 (YAFFS_TRACE_VERIFY | YAFFS_TRACE_VERIFY_FULL));
 }
 
 static int yaffs_skip_full_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask & (YAFFS_TRACE_VERIFY_FULL));
 }
 
 static int yaffs_skip_nand_verification(struct yaffs_dev *dev)
 {
-	dev = dev;
 	return !(yaffs_trace_mask & (YAFFS_TRACE_VERIFY_NAND));
 }
 
@@ -521,6 +518,5 @@ void yaffs_verify_free_chunks(struct yaffs_dev *dev)
 
 int yaffs_verify_file_sane(struct yaffs_obj *in)
 {
-	in = in;
 	return YAFFS_OK;
 }
diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c
index 334598e..41e5f01 100644
--- a/fs/yaffs2/yaffsfs.c
+++ b/fs/yaffs2/yaffsfs.c
@@ -3136,10 +3136,6 @@ int yaffs_link(const YCHAR *oldpath, const YCHAR *linkpath)
 
 int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev)
 {
-	pathname = pathname;
-	mode = mode;
-	dev = dev;
-
 	yaffsfs_SetError(-EINVAL);
 	return -1;
 }
@@ -3187,9 +3183,7 @@ int yaffs_set_error(int error)
 
 int yaffs_dump_dev(const YCHAR *path)
 {
-#if 1
-	path = path;
-#else
+#if 0
 	YCHAR *rest;
 
 	struct yaffs_obj *obj = yaffsfs_FindRoot(path, &rest);
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 2/2] yaffs2: preprocessor cleanup
  2014-07-12 13:16 ` [U-Boot] [PATCH v2 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
  2014-07-12 13:16   ` [U-Boot] [PATCH v2 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
@ 2014-07-12 13:16   ` Jeroen Hofstee
  2014-07-21 20:43     ` [U-Boot] [U-Boot,v2,2/2] " Tom Rini
  1 sibling, 1 reply; 9+ messages in thread
From: Jeroen Hofstee @ 2014-07-12 13:16 UTC (permalink / raw)
  To: u-boot

Current code uses the preprocessor to change an else case
to a statement without any if condition at all. Although
this works, change the optional code to return early, so
all optional code is contained within a single #ifdef.

Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 fs/yaffs2/yaffs_guts.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c
index 1fa5910..32e6ff2 100644
--- a/fs/yaffs2/yaffs_guts.c
+++ b/fs/yaffs2/yaffs_guts.c
@@ -3203,19 +3203,18 @@ static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR *name,
 		} else {
 			yaffs_strncpy(name, oh_name + 1, buff_size - 1);
 		}
-	} else {
-#else
-	{
-#endif
-		yaffs_strncpy(name, oh_name, buff_size - 1);
+
+		return;
 	}
+#endif
+
+	yaffs_strncpy(name, oh_name, buff_size - 1);
 }
 
 static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
 				    const YCHAR *name)
 {
 #ifdef CONFIG_YAFFS_AUTO_UNICODE
-
 	int is_ascii;
 	YCHAR *w;
 
@@ -3246,12 +3245,12 @@ static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR *oh_name,
 			*oh_name = 0;
 			yaffs_strncpy(oh_name + 1, name, YAFFS_MAX_NAME_LENGTH - 2);
 		}
-	} else {
-#else
-	{
-#endif
-		yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
+
+		return;
 	}
+#endif
+
+	yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
 }
 
 /* UpdateObjectHeader updates the header on NAND for an object.
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, v2, 1/2] yaffs2: cosmetic: remove self assignments
  2014-07-12 13:16   ` [U-Boot] [PATCH v2 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
@ 2014-07-21 20:43     ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2014-07-21 20:43 UTC (permalink / raw)
  To: u-boot

On Sat, Jul 12, 2014 at 03:16:51PM +0200, Jeroen Hofstee wrote:

> Remove self assignments which is just dead code to prevent
> compiler warnings about non used arguments. For u-boot this
> does not prevent any warning though, on the contrary it actual
> introduces warnings when compiling with clang. Remove them.
> 
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140721/a90bf46e/attachment.pgp>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot,v2,2/2] yaffs2: preprocessor cleanup
  2014-07-12 13:16   ` [U-Boot] [PATCH v2 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
@ 2014-07-21 20:43     ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2014-07-21 20:43 UTC (permalink / raw)
  To: u-boot

On Sat, Jul 12, 2014 at 03:16:52PM +0200, Jeroen Hofstee wrote:

> Current code uses the preprocessor to change an else case
> to a statement without any if condition at all. Although
> this works, change the optional code to return early, so
> all optional code is contained within a single #ifdef.
> 
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140721/17c1f68e/attachment.pgp>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-07-21 20:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-21 18:58 [U-Boot] [PATCH 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
2014-06-21 18:58 ` [U-Boot] [PATCH 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
2014-06-21 18:58 ` [U-Boot] [PATCH 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
2014-06-21 19:04   ` Jeroen Hofstee
2014-07-12 13:16 ` [U-Boot] [PATCH v2 0/2] yaffs2: fix clang warnings and small cleanup Jeroen Hofstee
2014-07-12 13:16   ` [U-Boot] [PATCH v2 1/2] yaffs2: cosmetic: remove self assignments Jeroen Hofstee
2014-07-21 20:43     ` [U-Boot] [U-Boot, v2, " Tom Rini
2014-07-12 13:16   ` [U-Boot] [PATCH v2 2/2] yaffs2: preprocessor cleanup Jeroen Hofstee
2014-07-21 20:43     ` [U-Boot] [U-Boot,v2,2/2] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox