drm/vc4: Fix compilation error reported by kbuild test bot
diff mbox series

Message ID 2b6ed5e6-81b0-4276-8860-870b54ca3262@linux.intel.com
State New
Headers show
Series
  • drm/vc4: Fix compilation error reported by kbuild test bot
Related show

Commit Message

Maarten Lankhorst April 24, 2019, 3:06 p.m. UTC
Op 24-04-2019 om 15:12 schreef kbuild test robot:
> tree:   git://anongit.freedesktop.org/drm/drm-misc for-linux-next-fixes
> head:   d08106796a78a4273e39e1bbdf538dc4334b2635
> commit: d08106796a78a4273e39e1bbdf538dc4334b2635 [1/1] drm/vc4: Fix memory leak during gpu reset.
> reproduce:
>         # apt-get install sparse
>         git checkout d08106796a78a4273e39e1bbdf538dc4334b2635
>         make ARCH=x86_64 allmodconfig
>         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> sparse warnings: (new ones prefixed by >>)
>
>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected struct drm_crtc *crtc @@    got structstruct drm_crtc *crtc @@
>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    expected struct drm_crtc *crtc
>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    got struct drm_crtc_state *state
>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:39: sparse: sparse: not enough arguments for function vc4_crtc_destroy_state
> vim +1045 drivers/gpu/drm/vc4/vc4_crtc.c
>
>   1040	
>   1041	static void
>   1042	vc4_crtc_reset(struct drm_crtc *crtc)
>   1043	{
>   1044		if (crtc->state)
>> 1045			vc4_crtc_destroy_state(crtc->state);
>   1046	
>   1047		crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
>   1048		if (crtc->state)
>   1049			crtc->state->crtc = crtc;
>   1050	}
>   1051	
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

-----8<----
A pointer to crtc was missing, resulting in the following build error:
drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse: sparse: incorrect type in argument 1 (different base types)
drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    expected struct drm_crtc *crtc
drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    got struct drm_crtc_state *state
drivers/gpu/drm/vc4/vc4_crtc.c:1045:39: sparse: sparse: not enough arguments for function vc4_crtc_destroy_state

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reported-by: kbuild test robot <lkp@intel.com>
Cc: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maarten Lankhorst April 24, 2019, 3:23 p.m. UTC | #1
Op 24-04-2019 om 17:06 schreef Maarten Lankhorst:
> Op 24-04-2019 om 15:12 schreef kbuild test robot:
>> tree:   git://anongit.freedesktop.org/drm/drm-misc for-linux-next-fixes
>> head:   d08106796a78a4273e39e1bbdf538dc4334b2635
>> commit: d08106796a78a4273e39e1bbdf538dc4334b2635 [1/1] drm/vc4: Fix memory leak during gpu reset.
>> reproduce:
>>         # apt-get install sparse
>>         git checkout d08106796a78a4273e39e1bbdf538dc4334b2635
>>         make ARCH=x86_64 allmodconfig
>>         make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
>>
>> If you fix the issue, kindly add following tag
>> Reported-by: kbuild test robot <lkp@intel.com>
>>
>> sparse warnings: (new ones prefixed by >>)
>>
>>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse: sparse: incorrect type in argument 1 (different base types) @@    expected struct drm_crtc *crtc @@    got structstruct drm_crtc *crtc @@
>>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    expected struct drm_crtc *crtc
>>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    got struct drm_crtc_state *state
>>>> drivers/gpu/drm/vc4/vc4_crtc.c:1045:39: sparse: sparse: not enough arguments for function vc4_crtc_destroy_state
>> vim +1045 drivers/gpu/drm/vc4/vc4_crtc.c
>>
>>   1040	
>>   1041	static void
>>   1042	vc4_crtc_reset(struct drm_crtc *crtc)
>>   1043	{
>>   1044		if (crtc->state)
>>> 1045			vc4_crtc_destroy_state(crtc->state);
>>   1046	
>>   1047		crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
>>   1048		if (crtc->state)
>>   1049			crtc->state->crtc = crtc;
>>   1050	}
>>   1051	
>>
>> ---
>> 0-DAY kernel test infrastructure                Open Source Technology Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> -----8<----
> A pointer to crtc was missing, resulting in the following build error:
> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse: sparse: incorrect type in argument 1 (different base types)
> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    expected struct drm_crtc *crtc
> drivers/gpu/drm/vc4/vc4_crtc.c:1045:44: sparse:    got struct drm_crtc_state *state
> drivers/gpu/drm/vc4/vc4_crtc.c:1045:39: sparse: sparse: not enough arguments for function vc4_crtc_destroy_state
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> Cc: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/vc4/vc4_crtc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index e7c04a9eb219..1baa10e94484 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -1042,7 +1042,7 @@ static void
>  vc4_crtc_reset(struct drm_crtc *crtc)
>  {
>  	if (crtc->state)
> -		vc4_crtc_destroy_state(crtc->state);
> +		vc4_crtc_destroy_state(crtc, crtc->state);
>  
>  	crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
>  	if (crtc->state)

Pushed with Daniel's irc ack. :)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index e7c04a9eb219..1baa10e94484 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -1042,7 +1042,7 @@  static void
 vc4_crtc_reset(struct drm_crtc *crtc)
 {
 	if (crtc->state)
-		vc4_crtc_destroy_state(crtc->state);
+		vc4_crtc_destroy_state(crtc, crtc->state);
 
 	crtc->state = kzalloc(sizeof(struct vc4_crtc_state), GFP_KERNEL);
 	if (crtc->state)