diff mbox

drm/atomic: Don't try to free a NULL state

Message ID 1427713543-2541-1-git-send-email-ander.conselvan.de.oliveira@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ander Conselvan de Oliveira March 30, 2015, 11:05 a.m. UTC
Consistently with other free functions, handle the NULL case without
oopsing.

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 drivers/gpu/drm/drm_atomic.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

David Weinehall March 30, 2015, 11:35 a.m. UTC | #1
On Mon, Mar 30, 2015 at 02:05:43PM +0300, Ander Conselvan de Oliveira wrote:
> Consistently with other free functions, handle the NULL case without
> oopsing.
> 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> ---
>  drivers/gpu/drm/drm_atomic.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 23034e8..88b2790 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -179,6 +179,9 @@ EXPORT_SYMBOL(drm_atomic_state_clear);
>   */
>  void drm_atomic_state_free(struct drm_atomic_state *state)
>  {
> +	if (!state)
> +		return;
> +
>  	drm_atomic_state_clear(state);
>  
>  	DRM_DEBUG_ATOMIC("Freeing atomic state %p\n", state);

It'd probably make sense to fix all code that uses
drm_atomic_state_free() at the same time.


Regards, David Weinehall
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 23034e8..88b2790 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -179,6 +179,9 @@  EXPORT_SYMBOL(drm_atomic_state_clear);
  */
 void drm_atomic_state_free(struct drm_atomic_state *state)
 {
+	if (!state)
+		return;
+
 	drm_atomic_state_clear(state);
 
 	DRM_DEBUG_ATOMIC("Freeing atomic state %p\n", state);