Commit 08373edc authored by Daniel Vetter's avatar Daniel Vetter

drm/gm12u320: More drmm_

The drm_mode_config_cleanup call we can drop, and all the allocations
we can switch over to drmm_kzalloc. Unfortunately the work queue is
still present, so can't get rid of the drm_driver->release function
outright.

v2: Use drmm_mode_config_init() for more clarity (Sam, Thomas)

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com> (v1)
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-43-daniel.vetter@ffwll.ch
parent c792098b
......@@ -160,7 +160,7 @@ static int gm12u320_usb_alloc(struct gm12u320_device *gm12u320)
int i, block_size;
const char *hdr;
gm12u320->cmd_buf = kmalloc(CMD_SIZE, GFP_KERNEL);
gm12u320->cmd_buf = drmm_kmalloc(&gm12u320->dev, CMD_SIZE, GFP_KERNEL);
if (!gm12u320->cmd_buf)
return -ENOMEM;
......@@ -173,7 +173,8 @@ static int gm12u320_usb_alloc(struct gm12u320_device *gm12u320)
hdr = data_block_header;
}
gm12u320->data_buf[i] = kzalloc(block_size, GFP_KERNEL);
gm12u320->data_buf[i] = drmm_kzalloc(&gm12u320->dev,
block_size, GFP_KERNEL);
if (!gm12u320->data_buf[i])
return -ENOMEM;
......@@ -192,15 +193,8 @@ static int gm12u320_usb_alloc(struct gm12u320_device *gm12u320)
static void gm12u320_usb_free(struct gm12u320_device *gm12u320)
{
int i;
if (gm12u320->fb_update.workq)
destroy_workqueue(gm12u320->fb_update.workq);
for (i = 0; i < GM12U320_BLOCK_COUNT; i++)
kfree(gm12u320->data_buf[i]);
kfree(gm12u320->cmd_buf);
}
static int gm12u320_misc_request(struct gm12u320_device *gm12u320,
......@@ -636,7 +630,6 @@ static void gm12u320_driver_release(struct drm_device *dev)
struct gm12u320_device *gm12u320 = dev->dev_private;
gm12u320_usb_free(gm12u320);
drm_mode_config_cleanup(dev);
}
DEFINE_DRM_GEM_FOPS(gm12u320_fops);
......@@ -693,7 +686,10 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
dev->dev_private = gm12u320;
drmm_add_final_kfree(dev, gm12u320);
drm_mode_config_init(dev);
ret = drmm_mode_config_init(dev);
if (ret)
goto err_put;
dev->mode_config.min_width = GM12U320_USER_WIDTH;
dev->mode_config.max_width = GM12U320_USER_WIDTH;
dev->mode_config.min_height = GM12U320_HEIGHT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment