From patchwork Fri Feb 21 21:03:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11397555 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB79217EF for ; Fri, 21 Feb 2020 21:05:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A6222073A for ; Fri, 21 Feb 2020 21:05:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="dB05jTow" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A6222073A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D19C06F57B; Fri, 21 Feb 2020 21:05:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id C9EC76F54C for ; Fri, 21 Feb 2020 21:04:24 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id z7so3506667wrl.13 for ; Fri, 21 Feb 2020 13:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K3z4R4E/niNnxqwdT4OzX8ORYsEpH0T1EdhGV4YfgW0=; b=dB05jTowMXCEtWzg0MdIdsmPlWaqUXl1ZM+qjbTB99mLx5oLbRmrafVmHK88DELEkH rT7OnfcquFZWpGQUVdPk0oEb4qYjnTeIRiXOWIdV2d2rSi1zqjtrhbG2fSSOaSHD7P/u A1nOek5r4lB/NdgfEKxFpYxDYb+sKKhYv8mKA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K3z4R4E/niNnxqwdT4OzX8ORYsEpH0T1EdhGV4YfgW0=; b=oyGQ1U1E2RpEDHPIooqaaLzIZiXuu0nuw2FBzIrh2E21s3qumV4oUnRsxpwM0KIrlA 0QbjxnKLv9M6k1JY5xyZmvKqwjgISoZOX/hgLLM+vFbcG3gs758NMZ1/ZV2LkNmqW6Kh s6Xs3pnb6nUSCyJ6+mau07QpGzzV7AO9yzGVCCV3Mp4TRJ6GN5Fhv+MVK75fUoGMJlex VIx+XFw08dvgTYonBZRSfnWXyYz4GzY28ufMFt1ASrzYP3W0EZ1TqaAfcwqUr8C+ViwY zG0c/xFoptfMVENXDxFbo8x4o6nyMmaKxCZCYDyTaIFCFE36l+guo+srCJvsB5pFFbVS 49iQ== X-Gm-Message-State: APjAAAW7jSXpj2ZbgiPosxGd+mM6dIu/vAqlWqxWI1pmeKBykcHm9+4h 7WNYb44KxBQ7LSC6jdRXC2rNdA== X-Google-Smtp-Source: APXvYqxaFcQVEYPAtmL1YMOaV0kHzqG5vuSJhOXUO1ovp202FlX3ibrrCCgbtLXCIVBjKjZmaikQQg== X-Received: by 2002:a5d:5452:: with SMTP id w18mr48092810wrv.333.1582319063526; Fri, 21 Feb 2020 13:04:23 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id z6sm5483930wrw.36.2020.02.21.13.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 13:04:22 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Fri, 21 Feb 2020 22:03:10 +0100 Message-Id: <20200221210319.2245170-43-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200221210319.2245170-1-daniel.vetter@ffwll.ch> References: <20200221210319.2245170-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 42/51] drm/gm12u320: More drmm_ X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , =?utf-8?q?Nor?= =?utf-8?q?alf_Tr=C3=B8nnes?= , Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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. Signed-off-by: Daniel Vetter Cc: Hans de Goede Cc: "Noralf Trønnes" Reviewed-by: Hans de Goede --- drivers/gpu/drm/tiny/gm12u320.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c index 3928f69bbd3d..5bd26fc6fafa 100644 --- a/drivers/gpu/drm/tiny/gm12u320.c +++ b/drivers/gpu/drm/tiny/gm12u320.c @@ -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 = drm_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;