In drm_master_destroy() we _free_ the master object. There is no reason to
hold any locks while dropping its static members, nor do we have to reset
it to 0.

Furthermore, kfree() already does NULL checks, so call it directly on
master->unique and drop the redundant reset-code.

Signed-off-by: David Herrmann <dh.herrmann at gmail.com>
---
 drivers/gpu/drm/drm_drv.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 88b594c..3b3c4f5 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -132,15 +132,10 @@ static void drm_master_destroy(struct kref *kref)
                        r_list = NULL;
                }
        }
-
-       if (master->unique) {
-               kfree(master->unique);
-               master->unique = NULL;
-               master->unique_len = 0;
-       }
        mutex_unlock(&dev->struct_mutex);

        idr_destroy(&master->magic_map);
+       kfree(master->unique);
        kfree(master);
 }

-- 
2.3.7

Reply via email to