Skip to contentSkip to conversation

media: imx-media-internal-sd: Use empty initializer

PATCH Superseded Fabio Estevam 3 participants 4 messages Feb 9, 2018 – Feb 10, 2018

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH v2 1/1 media: imx-media-internal-sd: Use empty initializer

From: Fabio Estevam <[email protected]>

When building with W=1 the following warning shows up:

drivers/staging/media/imx/imx-media-internal-sd.c:274:49: warning: Using plain integer as NULL pointer

Fix this problem by using an empty initializer, which guarantees that all struct members are zero-cleared.

---
Changes since v1:
- Use empty initializer insted of memset() - Ian

 drivers/staging/media/imx/imx-media-internal-sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-internal-sd.c +1 -1
index 70833fe..daf66c2 100644
@@ -271,7 +271,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,
 			       int ipu_id)
 {
 	struct imx_media_internal_sd_platformdata pdata;
-	struct platform_device_info pdevinfo = {0};
+	struct platform_device_info pdevinfo = {};
 	struct platform_device *pdev;
 
 	pdata.grp_id = isd->id->grp_id;
Signature · 1 line
2.7.4
maintainer
#1 lore raw

Hi Fabio,

Quoted 8 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When building with W=1 the following warning shows up:

drivers/staging/media/imx/imx-media-internal-sd.c:274:49: warning: Using plain integer as NULL pointer

Fix this problem by using an empty initializer, which guarantees that all struct members are zero-cleared.

There is one other case of the use of "{0}" to initialize a stack/local struct, in prp_enum_frame_size(). It should be fixed there as well, to be consistent.

Steve

Quoted 22 lines

---
Changes since v1:
- Use empty initializer insted of memset() - Ian

  drivers/staging/media/imx/imx-media-internal-sd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-internal-sd.c +1 -1
index 70833fe..daf66c2 100644
@@ -271,7 +271,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,
  			       int ipu_id)
  {
  	struct imx_media_internal_sd_platformdata pdata;
-	struct platform_device_info pdevinfo = {0};
+	struct platform_device_info pdevinfo = {};
  	struct platform_device *pdev;
 
  	pdata.grp_id = isd->id->grp_id;
author reviewer
#2 lore raw

Hi Steve,

Quoted 3 lines · Steve Longerbeam

There is one other case of the use of "{0}" to initialize a stack/local struct, in prp_enum_frame_size(). It should be fixed there as well, to be consistent.

Yes, just sent a patch as you suggested.

Thanks

Acked-by on v2 1/1
#3 lore raw
In reply to Fabio Estevam
Quoted 30 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When building with W=1 the following warning shows up:

drivers/staging/media/imx/imx-media-internal-sd.c:274:49: warning: Using plain integer as NULL pointer

Fix this problem by using an empty initializer, which guarantees that all struct members are zero-cleared.

---
Changes since v1:
- Use empty initializer insted of memset() - Ian

  drivers/staging/media/imx/imx-media-internal-sd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-internal-sd.c +1 -1
index 70833fe..daf66c2 100644
@@ -271,7 +271,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,
  			       int ipu_id)
  {
  	struct imx_media_internal_sd_platformdata pdata;
-	struct platform_device_info pdevinfo = {0};
+	struct platform_device_info pdevinfo = {};
  	struct platform_device *pdev;
 
  	pdata.grp_id = isd->id->grp_id;