diff mbox series

video: of: display_timing: Remove a redundant zeroing of memory

Message ID 99f22ad1068fbbbc95acea59871cd408cde2623d.1647981212.git.christophe.jaillet@wanadoo.fr
State New
Headers show
Series video: of: display_timing: Remove a redundant zeroing of memory | expand

Commit Message

Christophe JAILLET March 22, 2022, 8:33 p.m. UTC
of_parse_display_timing() already call memset(0) on its 2nd argument, so
there is no need to clear it explicitly before calling this function.

Use kmalloc() instead of kzalloc() to save a few cycles.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/video/of_display_timing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Helge Deller March 24, 2022, 6:38 a.m. UTC | #1
On 3/22/22 21:33, Christophe JAILLET wrote:
> of_parse_display_timing() already call memset(0) on its 2nd argument, so
> there is no need to clear it explicitly before calling this function.
>
> Use kmalloc() instead of kzalloc() to save a few cycles.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

applied.

Thanks!
Helge

> ---
>  drivers/video/of_display_timing.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
> index f93b6abbe258..bebd371c6b93 100644
> --- a/drivers/video/of_display_timing.c
> +++ b/drivers/video/of_display_timing.c
> @@ -199,7 +199,7 @@ struct display_timings *of_get_display_timings(const struct device_node *np)
>  		struct display_timing *dt;
>  		int r;
>
> -		dt = kzalloc(sizeof(*dt), GFP_KERNEL);
> +		dt = kmalloc(sizeof(*dt), GFP_KERNEL);
>  		if (!dt) {
>  			pr_err("%pOF: could not allocate display_timing struct\n",
>  				np);
diff mbox series

Patch

diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index f93b6abbe258..bebd371c6b93 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -199,7 +199,7 @@  struct display_timings *of_get_display_timings(const struct device_node *np)
 		struct display_timing *dt;
 		int r;
 
-		dt = kzalloc(sizeof(*dt), GFP_KERNEL);
+		dt = kmalloc(sizeof(*dt), GFP_KERNEL);
 		if (!dt) {
 			pr_err("%pOF: could not allocate display_timing struct\n",
 				np);