diff mbox series

common: update: fix an "unused" warning against update_flash()

Message ID 20201117002646.13750-1-takahiro.akashi@linaro.org
State Changes Requested, archived
Delegated to: Heinrich Schuchardt
Headers show
Series common: update: fix an "unused" warning against update_flash() | expand

Commit Message

AKASHI Takahiro Nov. 17, 2020, 12:26 a.m. UTC
Since update_flash() is used only in update_tftp(), it should be
guarded with appropriate config options.

Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT
       image")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 common/update.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Heinrich Schuchardt Nov. 18, 2020, 4:26 p.m. UTC | #1
On 17.11.20 01:26, AKASHI Takahiro wrote:
> Since update_flash() is used only in update_tftp(), it should be
> guarded with appropriate config options.

You are not adding an additional guard but relaxing guards. Your commit
message does not capture this.

Here is an example requiring your patch:

r8a77990_ebisu_defconfig with CONFIG_DFU_TFTP=n does not compile without
the patch.

Please, update the commit message.

Otherwise the patch looks ok to me.

Best regards

Heinrich

>
> Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT
>        image")
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  common/update.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/common/update.c b/common/update.c
> index 808be0880dfd..a5879cb52c41 100644
> --- a/common/update.c
> +++ b/common/update.c
> @@ -29,7 +29,7 @@
>  #include <errno.h>
>  #include <mtd/cfi_flash.h>
>
> -#ifdef CONFIG_DFU_TFTP
> +#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
>  /* env variable holding the location of the update file */
>  #define UPDATE_FILE_ENV		"updatefile"
>
> @@ -99,7 +99,6 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
>
>  	return rv;
>  }
> -#endif /* CONFIG_DFU_TFTP */
>
>  #ifdef CONFIG_MTD_NOR_FLASH
>  static int update_flash_protect(int prot, ulong addr_first, ulong addr_last)
> @@ -216,6 +215,7 @@ static int update_flash(ulong addr_source, ulong addr_first, ulong size)
>  #endif
>  	return 0;
>  }
> +#endif /* CONFIG_DFU_TFTP || CONFIG_UPDATE_TFTP */
>
>  static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
>  						ulong *fladdr, ulong *size)
> @@ -233,7 +233,7 @@ static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
>  	return 0;
>  }
>
> -#ifdef CONFIG_DFU_TFTP
> +#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
>  int update_tftp(ulong addr, char *interface, char *devstring)
>  {
>  	char *filename, *env_addr, *fit_image_name;
> @@ -340,7 +340,7 @@ next_node:
>
>  	return ret;
>  }
> -#endif /* CONFIG_DFU_UPDATE */
> +#endif /* CONFIG_DFU_UPDATE || CONFIG_UPDATE_TFTP */
>
>  #ifdef CONFIG_UPDATE_FIT
>  /**
>

common/Makefile has this line:
obj-$(CONFIG_UPDATE_COMMON) += update.o

UPDATE_TFTP, UPDATE_FIT, DFU_TFTP all select UPDATE_COMMON.
diff mbox series

Patch

diff --git a/common/update.c b/common/update.c
index 808be0880dfd..a5879cb52c41 100644
--- a/common/update.c
+++ b/common/update.c
@@ -29,7 +29,7 @@ 
 #include <errno.h>
 #include <mtd/cfi_flash.h>
 
-#ifdef CONFIG_DFU_TFTP
+#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
 /* env variable holding the location of the update file */
 #define UPDATE_FILE_ENV		"updatefile"
 
@@ -99,7 +99,6 @@  static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)
 
 	return rv;
 }
-#endif /* CONFIG_DFU_TFTP */
 
 #ifdef CONFIG_MTD_NOR_FLASH
 static int update_flash_protect(int prot, ulong addr_first, ulong addr_last)
@@ -216,6 +215,7 @@  static int update_flash(ulong addr_source, ulong addr_first, ulong size)
 #endif
 	return 0;
 }
+#endif /* CONFIG_DFU_TFTP || CONFIG_UPDATE_TFTP */
 
 static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
 						ulong *fladdr, ulong *size)
@@ -233,7 +233,7 @@  static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
 	return 0;
 }
 
-#ifdef CONFIG_DFU_TFTP
+#if defined(CONFIG_DFU_TFTP) || defined(CONFIG_UPDATE_TFTP)
 int update_tftp(ulong addr, char *interface, char *devstring)
 {
 	char *filename, *env_addr, *fit_image_name;
@@ -340,7 +340,7 @@  next_node:
 
 	return ret;
 }
-#endif /* CONFIG_DFU_UPDATE */
+#endif /* CONFIG_DFU_UPDATE || CONFIG_UPDATE_TFTP */
 
 #ifdef CONFIG_UPDATE_FIT
 /**