media: imx-media-internal-sd: Use memset to clear pdevinfo struct
PATCH 1/1 media: imx-media-internal-sd: Use memset to clear pdevinfo struct
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 memset() to clear the pdevinfo structure.
--- drivers/staging/media/imx/imx-media-internal-sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-internal-sd.c +2 -1
@@ -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;
@@ -283,6 +283,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,imx_media_grp_id_to_sd_name (pdata.sd_name,sizeof (pdata.sd_name), pdata.grp_id, ipu_id); +memset (&pdevinfo,0 ,sizeof (pdevinfo)); pdevinfo.name = isd->id->name; pdevinfo.id = ipu_id * num_isd + isd->id->index; pdevinfo.parent = imxmd->md.dev;
Signature · 1 line
2.14.1
Quoted 5 lines · Fabio Estevam
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 pointerFix this problem by using
memset()to clear the pdevinfo structure.
Hi Fabio,
I thought initializers were preferred to memset. I think the problem here is the first element of the struct is a pointer. Maybe this would be better?
struct platform_device_info pdevinfo = {NULL};
I see similar patches, for example:
https://patchwork.kernel.org/patch/10095129/
Regards,
IanJ
Quoted 28 lines
Signed-off-by Fabio Estevam <[email protected]>--- drivers/staging/media/imx/imx-media-internal-sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/staging/media/imx/imx-media-internal-sd.c +2
-1@@ -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;@@ -283,6 +283,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,imx_media_grp_id_to_sd_name (pdata.sd_name,sizeof (pdata.sd_name), pdata.grp_id, ipu_id); +memset (&pdevinfo,0 ,sizeof (pdevinfo)); pdevinfo.name = isd->id->name; pdevinfo.id = ipu_id * num_isd + isd->id->index; pdevinfo.parent = imxmd->md.dev;
Quoted 5 lines · Ian Arkver
Quoted 4 lines · Fabio Estevam
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
Quoted 7 lines
Quoted 1 line
Fix this problem by using
memset()to clear the pdevinfo structure.Hi Fabio,
I thought initializers were preferred to memset. I think the problem here is the first element of the struct is a pointer. Maybe this would be better?
struct
platform_device_infopdevinfo = {NULL};
Actually an empty initialiser list would be better again.
eg:
https://patchwork.kernel.org/patch/9480131/
Quoted 33 lines
I see similar patches, for example:
https://patchwork.kernel.org/patch/10095129/Regards,
IanJQuoted 28 lines
Signed-off-by Fabio Estevam <[email protected]>---
drivers/staging/media/imx/imx-media-internal-sd.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)drivers/staging/media/imx/imx-media-internal-sd.c +2
-1@@ -271,7 +271,7 @@ static int add_internal_subdev(structimx_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;@@ -283,6 +283,7 @@ static int add_internal_subdev(structimx_media_dev *imxmd, imx_media_grp_id_to_sd_name(pdata.sd_name, sizeof(pdata.sd_name), pdata.grp_id, ipu_id); + memset(&pdevinfo, 0, sizeof(pdevinfo)); pdevinfo.name = isd->id->name; pdevinfo.id = ipu_id * num_isd + isd->id->index; pdevinfo.parent = imxmd->md.dev;