diff mbox

spi: include "int ret" with macro

Message ID 1403661276-16598-1-git-send-email-B45475@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhao Qiang June 25, 2014, 1:54 a.m. UTC
ret is unused when CONFIG_FSL_SOC defined,
so include it with "#ifndef CONFIG_FSL_SOC".

Signed-off-by: Zhao Qiang <B45475@freescale.com>
---
 drivers/spi/spi-fsl-lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Laight June 25, 2014, 8:44 a.m. UTC | #1
From: Zhao Qiang

> ret is unused when CONFIG_FSL_SOC defined,

> so include it with "#ifndef CONFIG_FSL_SOC".

> 

> Signed-off-by: Zhao Qiang <B45475@freescale.com>

> ---

>  drivers/spi/spi-fsl-lib.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c

> index e5d45fc..44aace1 100644

> --- a/drivers/spi/spi-fsl-lib.c

> +++ b/drivers/spi/spi-fsl-lib.c

> @@ -198,8 +198,9 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)

>  	struct mpc8xxx_spi_probe_info *pinfo;

>  	struct fsl_spi_platform_data *pdata;

>  	const void *prop;

> +#ifndef CONFIG_FSL_SOC

>  	int ret = -ENOMEM;

> -

> +#endif


You are removing the blank line after the definition of the locals,
and the initialiser isn't needed.

>  	pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL);

>  	if (!pinfo)

>  		return -ENOMEM;

> --


I think it might be preferable to define 'ret' inside the conditional
where it is used - which requires an extra {...} block.

A 'sneaky' way to avoid the warning is to 'return ret' when the kzalloc() fails.

	David
diff mbox

Patch

diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
index e5d45fc..44aace1 100644
--- a/drivers/spi/spi-fsl-lib.c
+++ b/drivers/spi/spi-fsl-lib.c
@@ -198,8 +198,9 @@  int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
 	struct mpc8xxx_spi_probe_info *pinfo;
 	struct fsl_spi_platform_data *pdata;
 	const void *prop;
+#ifndef CONFIG_FSL_SOC
 	int ret = -ENOMEM;
-
+#endif
 	pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL);
 	if (!pinfo)
 		return -ENOMEM;