[2/4] bus/fslmc: fix printf of null pointer

Message ID 20190501195014.2938-3-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Headers
Series fix warnings with gcc 9 on Fedora 30 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Bruce Richardson May 1, 2019, 7:50 p.m. UTC
  Printing a null pointer with %s is flagged as a warning by GCC 9, and
should not be done. Replace the %s with the word "null" itself.

Fixes: 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
Cc: shreyansh.jain@nxp.com

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

David Marchand May 2, 2019, 12:20 p.m. UTC | #1
On Wed, May 1, 2019 at 9:50 PM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> Printing a null pointer with %s is flagged as a warning by GCC 9, and
> should not be done. Replace the %s with the word "null" itself.
>
> Fixes: 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
> Cc: shreyansh.jain@nxp.com
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  drivers/bus/fslmc/fslmc_bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
> index eaa39a209..f6e66d22c 100644
> --- a/drivers/bus/fslmc/fslmc_bus.c
> +++ b/drivers/bus/fslmc/fslmc_bus.c
> @@ -197,7 +197,7 @@ scan_one_fslmc_device(char *dev_name)
>
>         t_ptr = strtok(NULL, ".");
>         if (!t_ptr) {
> -               DPAA2_BUS_ERR("Incorrect device string observed (%s)",
> t_ptr);
> +               DPAA2_BUS_ERR("Incorrect device string observed (null)");
>

I'd rather print dev_name here, since t_ptr == NULL means that dev_name
format is incorrect.
  

Patch

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index eaa39a209..f6e66d22c 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -197,7 +197,7 @@  scan_one_fslmc_device(char *dev_name)
 
 	t_ptr = strtok(NULL, ".");
 	if (!t_ptr) {
-		DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
+		DPAA2_BUS_ERR("Incorrect device string observed (null)");
 		goto cleanup;
 	}