Skip to contentSkip to conversation

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

PATCH New Fabio Estevam 1 participant 2 messages Feb 21, 2018

Subsystems (4)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

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

From: Fabio Estevam <[email protected]>

{0} explicitly assigns 0 to the first member of the structure.

The first element of the platform_device_info struct is a pointer and when writing 0 to a pointer the following sparse error is seen:

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 also clears the struct members and avoids the sparse warning.

---
Changes sice v2:
- Improve commit log

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
author reviewer
#1 lore raw

PATCH v3 2/2 media: imx-ic-prpencvf: Use empty initializer

From: Fabio Estevam <[email protected]>

{0} explicitly assigns 0 to the first member of the structure.

Even though the first member of the v4l2_subdev_format structure is of _u32 type, make the initialization more robust by using the empty initializer.

This way in case someday the struct is changed so that the first member becomes a pointer, we will not have sparse warnings.

---
Changes since v1:
- Improve commit log

 drivers/staging/media/imx/imx-ic-prpencvf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-ic-prpencvf.c +1 -1
index 143038c..60f392a 100644
@@ -923,7 +923,7 @@ static int prp_enum_frame_size(struct v4l2_subdev *sd,
 			       struct v4l2_subdev_frame_size_enum *fse)
 {
 	struct prp_priv *priv = sd_to_priv(sd);
-	struct v4l2_subdev_format format = {0};
+	struct v4l2_subdev_format format = {};
 	const struct imx_media_pixfmt *cc;
 	int ret = 0;
 
Signature · 1 line
2.7.4