Re: [PATCH] media: imx-media-internal-sd: Use memset to clear pdevinfo struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/02/18 21:17, Ian Arkver wrote:
On 09/02/18 16:36, Fabio Estevam wrote:
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.

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};

Actually an empty initialiser list would be better again.

eg:
https://patchwork.kernel.org/patch/9480131/

I see similar patches, for example:
https://patchwork.kernel.org/patch/10095129/

Regards,
IanJ

Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxx>
---
  drivers/staging/media/imx/imx-media-internal-sd.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c
index 70833fe503b5..377c20863b76 100644
--- a/drivers/staging/media/imx/imx-media-internal-sd.c
+++ b/drivers/staging/media/imx/imx-media-internal-sd.c
@@ -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;




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux