diff mbox series

spi: mxc_spi: fix warnings if CLK_ENABLED not set

Message ID 20210710145135.1873012-1-sbabic@denx.de
State Accepted
Commit 375d7e92980671c868788daf106e66d212faad6a
Delegated to: Stefano Babic
Headers show
Series spi: mxc_spi: fix warnings if CLK_ENABLED not set | expand

Commit Message

Stefano Babic July 10, 2021, 2:51 p.m. UTC
Following warnings (unused variables) are raised:

drivers/spi/mxc_spi.c: In function 'mxc_spi_probe':
drivers/spi/mxc_spi.c:595:14: error: unused variable 'blob' [-Werror=unused-variable]
595 |  const void *blob = gd->fdt_blob;
    |              ^~~~
drivers/spi/mxc_spi.c:594:6: error: unused variable 'node' [-Werror=unused-variable]
594 |  int node = dev_of_offset(bus);

Move the variable declaration inside the code where they are used.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 drivers/spi/mxc_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Frieder Schrempf July 12, 2021, 12:15 p.m. UTC | #1
On 10.07.21 16:51, Stefano Babic wrote:
> Following warnings (unused variables) are raised:
> 
> drivers/spi/mxc_spi.c: In function 'mxc_spi_probe':
> drivers/spi/mxc_spi.c:595:14: error: unused variable 'blob' [-Werror=unused-variable]
> 595 |  const void *blob = gd->fdt_blob;
>     |              ^~~~
> drivers/spi/mxc_spi.c:594:6: error: unused variable 'node' [-Werror=unused-variable]
> 594 |  int node = dev_of_offset(bus);
> 
> Move the variable declaration inside the code where they are used.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>

> ---
>  drivers/spi/mxc_spi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
> index f3dddbdbd7..a80c3e737d 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -591,8 +591,6 @@ void spi_release_bus(struct spi_slave *slave)
>  static int mxc_spi_probe(struct udevice *bus)
>  {
>  	struct mxc_spi_slave *mxcs = dev_get_plat(bus);
> -	int node = dev_of_offset(bus);
> -	const void *blob = gd->fdt_blob;
>  	int ret;
>  	int i;
>  
> @@ -629,6 +627,8 @@ static int mxc_spi_probe(struct udevice *bus)
>  
>  	mxcs->max_hz = clk_get_rate(&clk);
>  #else
> +	int node = dev_of_offset(bus);
> +	const void *blob = gd->fdt_blob;
>  	mxcs->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
>  				      20000000);
>  #endif
>
diff mbox series

Patch

diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index f3dddbdbd7..a80c3e737d 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -591,8 +591,6 @@  void spi_release_bus(struct spi_slave *slave)
 static int mxc_spi_probe(struct udevice *bus)
 {
 	struct mxc_spi_slave *mxcs = dev_get_plat(bus);
-	int node = dev_of_offset(bus);
-	const void *blob = gd->fdt_blob;
 	int ret;
 	int i;
 
@@ -629,6 +627,8 @@  static int mxc_spi_probe(struct udevice *bus)
 
 	mxcs->max_hz = clk_get_rate(&clk);
 #else
+	int node = dev_of_offset(bus);
+	const void *blob = gd->fdt_blob;
 	mxcs->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
 				      20000000);
 #endif