linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: del redundant type conversion
@ 2019-04-10  8:29 xiaojiangfeng
  2019-04-10 18:50 ` Frank Rowand
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xiaojiangfeng @ 2019-04-10  8:29 UTC (permalink / raw)
  To: robh+dt, frowand.list, robh, xiaojiangfeng; +Cc: devicetree, linux-kernel

The type of variable l in early_init_dt_scan_chosen is
int, there is no need to convert to int.

Signed-off-by: xiaojiangfeng <xiaojiangfeng@huawei.com>
---
 drivers/of/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 4734223..de893c9 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1091,7 +1091,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 	/* Retrieve command line */
 	p = of_get_flat_dt_prop(node, "bootargs", &l);
 	if (p != NULL && l > 0)
-		strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
+		strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
 
 	/*
 	 * CONFIG_CMDLINE is meant to be a default in case nothing else
-- 
1.8.5.6


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

* Re: [PATCH] of: del redundant type conversion
  2019-04-10  8:29 [PATCH] of: del redundant type conversion xiaojiangfeng
@ 2019-04-10 18:50 ` Frank Rowand
  2019-04-11  5:09 ` Frank Rowand
  2019-04-29 17:50 ` Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Rowand @ 2019-04-10 18:50 UTC (permalink / raw)
  To: xiaojiangfeng, robh+dt, robh; +Cc: devicetree, linux-kernel

On 4/10/19 1:29 AM, xiaojiangfeng wrote:
> The type of variable l in early_init_dt_scan_chosen is
> int, there is no need to convert to int.
> 
> Signed-off-by: xiaojiangfeng <xiaojiangfeng@huawei.com>
> ---
>  drivers/of/fdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 4734223..de893c9 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1091,7 +1091,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>  	/* Retrieve command line */
>  	p = of_get_flat_dt_prop(node, "bootargs", &l);
>  	if (p != NULL && l > 0)
> -		strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
> +		strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
>  
>  	/*
>  	 * CONFIG_CMDLINE is meant to be a default in case nothing else
> 

Thanks for catching the redundant cast.

There is a second problem detected by sparse on that line:

  drivers/of/fdt.c:1094:34: warning: expression using sizeof(void)

Can you please fix both issues?

Thanks,

Frank

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

* Re: [PATCH] of: del redundant type conversion
  2019-04-10  8:29 [PATCH] of: del redundant type conversion xiaojiangfeng
  2019-04-10 18:50 ` Frank Rowand
@ 2019-04-11  5:09 ` Frank Rowand
  2019-04-29 17:50 ` Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Rowand @ 2019-04-11  5:09 UTC (permalink / raw)
  To: xiaojiangfeng, robh+dt, robh; +Cc: devicetree, linux-kernel

On 4/10/19 1:29 AM, xiaojiangfeng wrote:
> The type of variable l in early_init_dt_scan_chosen is
> int, there is no need to convert to int.
> 
> Signed-off-by: xiaojiangfeng <xiaojiangfeng@huawei.com>
> ---
>  drivers/of/fdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 4734223..de893c9 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1091,7 +1091,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>  	/* Retrieve command line */
>  	p = of_get_flat_dt_prop(node, "bootargs", &l);
>  	if (p != NULL && l > 0)
> -		strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
> +		strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
>  
>  	/*
>  	 * CONFIG_CMDLINE is meant to be a default in case nothing else
> 

My first reply to this patch asked for a sparse warning on this line to
also be fixed.  After xiaojiangfeng followed up with a different patch
to try to resolve the issues with this line of code, I see that the
sparse warning was not caused by my first conjecture and this patch
is the correct one to apply.

I will pursue the cause of the sparse warning myself separately.


Reviewed-by: Frank Rowand <frank.rowand@sony.com>

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

* Re: [PATCH] of: del redundant type conversion
  2019-04-10  8:29 [PATCH] of: del redundant type conversion xiaojiangfeng
  2019-04-10 18:50 ` Frank Rowand
  2019-04-11  5:09 ` Frank Rowand
@ 2019-04-29 17:50 ` Rob Herring
  2 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2019-04-29 17:50 UTC (permalink / raw)
  To: xiaojiangfeng; +Cc: frowand.list, devicetree, linux-kernel

On Wed, Apr 10, 2019 at 04:29:41PM +0800, xiaojiangfeng wrote:
> The type of variable l in early_init_dt_scan_chosen is
> int, there is no need to convert to int.
> 
> Signed-off-by: xiaojiangfeng <xiaojiangfeng@huawei.com>
> ---
>  drivers/of/fdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied.

Rob

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

end of thread, other threads:[~2019-04-29 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10  8:29 [PATCH] of: del redundant type conversion xiaojiangfeng
2019-04-10 18:50 ` Frank Rowand
2019-04-11  5:09 ` Frank Rowand
2019-04-29 17:50 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).