diff mbox

[v2] media: imx-media-internal-sd: Use empty initializer

Message ID 1518217876-7037-1-git-send-email-festevam@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabio Estevam Feb. 9, 2018, 11:11 p.m. UTC
From: Fabio Estevam <fabio.estevam@nxp.com>

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.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
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(-)

Comments

Steve Longerbeam Feb. 9, 2018, 11:42 p.m. UTC | #1
Hi Fabio,


On 02/09/2018 03:11 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> 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

>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> 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(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c
> index 70833fe..daf66c2 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;
Fabio Estevam Feb. 10, 2018, 2:39 p.m. UTC | #2
Hi Steve,

On Fri, Feb 9, 2018 at 9:42 PM, Steve Longerbeam <slongerbeam@gmail.com> wrote:

> 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
Steve Longerbeam Feb. 10, 2018, 5:50 p.m. UTC | #3
Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>


On 02/09/2018 03:11 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> 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.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
> 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(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c
> index 70833fe..daf66c2 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;
diff mbox

Patch

diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c b/drivers/staging/media/imx/imx-media-internal-sd.c
index 70833fe..daf66c2 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;