linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media-device: Remove duplicated memset() in media_enum_entities()
@ 2014-06-07 14:41 Salva Peiró
  2014-06-07 15:55 ` Joe Perches
  2014-07-17 11:51 ` Laurent Pinchart
  0 siblings, 2 replies; 3+ messages in thread
From: Salva Peiró @ 2014-06-07 14:41 UTC (permalink / raw)
  Cc: Salva Peiró, linux-media, linux-kernel, stable

After the zeroing the whole struct struct media_entity_desc u_ent,
it is no longer necessary to memset(0) its u_ent.name field.

Signed-off-by: Salva Peiró <speiro@ai2.upv.es>

To: Mauro Carvalho Chehab <m.chehab@samsung.com>
CC: linux-media@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: stable@kernel.org
---
 drivers/media/media-device.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 703560f..88c1606 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -106,8 +106,6 @@ static long media_device_enum_entities(struct media_device *mdev,
 	if (ent->name) {
 		strncpy(u_ent.name, ent->name, sizeof(u_ent.name));
 		u_ent.name[sizeof(u_ent.name) - 1] = '\0';
-	} else {
-		memset(u_ent.name, 0, sizeof(u_ent.name));
 	}
 	u_ent.type = ent->type;
 	u_ent.revision = ent->revision;
-- 
1.7.10.4


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

* Re: [PATCH] media-device: Remove duplicated memset() in media_enum_entities()
  2014-06-07 14:41 [PATCH] media-device: Remove duplicated memset() in media_enum_entities() Salva Peiró
@ 2014-06-07 15:55 ` Joe Perches
  2014-07-17 11:51 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2014-06-07 15:55 UTC (permalink / raw)
  To: Salva Peiró; +Cc: linux-media, linux-kernel, stable

On Sat, 2014-06-07 at 16:41 +0200, Salva Peiró wrote:
> After the zeroing the whole struct struct media_entity_desc u_ent,
> it is no longer necessary to memset(0) its u_ent.name field.

trivia:

> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
[]
> @@ -106,8 +106,6 @@ static long media_device_enum_entities(struct media_device *mdev,
>  	if (ent->name) {
>  		strncpy(u_ent.name, ent->name, sizeof(u_ent.name));
>  		u_ent.name[sizeof(u_ent.name) - 1] = '\0';

this could be strlcpy too.




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

* Re: [PATCH] media-device: Remove duplicated memset() in media_enum_entities()
  2014-06-07 14:41 [PATCH] media-device: Remove duplicated memset() in media_enum_entities() Salva Peiró
  2014-06-07 15:55 ` Joe Perches
@ 2014-07-17 11:51 ` Laurent Pinchart
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2014-07-17 11:51 UTC (permalink / raw)
  To: Salva Peiró; +Cc: linux-media, linux-kernel, stable

Hi Salva,

Thank you for the patch.

On Saturday 07 June 2014 16:41:44 Salva Peiró wrote:
> After the zeroing the whole struct struct media_entity_desc u_ent,
> it is no longer necessary to memset(0) its u_ent.name field.
> 
> Signed-off-by: Salva Peiró <speiro@ai2.upv.es>
> 
> To: Mauro Carvalho Chehab <m.chehab@samsung.com>
> CC: linux-media@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> CC: stable@kernel.org

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and applied to my tree.

> ---
>  drivers/media/media-device.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 703560f..88c1606 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -106,8 +106,6 @@ static long media_device_enum_entities(struct
> media_device *mdev, if (ent->name) {
>  		strncpy(u_ent.name, ent->name, sizeof(u_ent.name));
>  		u_ent.name[sizeof(u_ent.name) - 1] = '\0';
> -	} else {
> -		memset(u_ent.name, 0, sizeof(u_ent.name));
>  	}
>  	u_ent.type = ent->type;
>  	u_ent.revision = ent->revision;

-- 
Regards,

Laurent Pinchart


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

end of thread, other threads:[~2014-07-17 11:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-07 14:41 [PATCH] media-device: Remove duplicated memset() in media_enum_entities() Salva Peiró
2014-06-07 15:55 ` Joe Perches
2014-07-17 11:51 ` Laurent Pinchart

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).