From patchwork Mon Mar 23 14:49:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11453309 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 04249174A for ; Mon, 23 Mar 2020 14:52:11 +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 D6D5420781 for ; Mon, 23 Mar 2020 14:52:10 +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="UhbbFXXJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6D5420781 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 44FDE6E25A; Mon, 23 Mar 2020 14:51:10 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73B406E247 for ; Mon, 23 Mar 2020 14:50:57 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id j17so14031796wru.13 for ; Mon, 23 Mar 2020 07:50:57 -0700 (PDT) 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=Z93YHdc5rIfXXQ9c0d1lgZMCmwRt2rA3AMMFMsoh+Us=; b=UhbbFXXJx40Fh81Y1I1CxQ2mM9Q/eXQ/vVTJFwYeEDAEfZhFPBT2NRWLnHjHimdpVo AziH/fmC+hFLrjUD5hc2wvktidBR/Pl+sFuFEdl30mljNUCAk/Y1EeXIwNIKHRwjaMBu +z+T4PZhbvvj0IIjXyGGwVQhqFBPBRVtTAtIw= 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=Z93YHdc5rIfXXQ9c0d1lgZMCmwRt2rA3AMMFMsoh+Us=; b=Psl3Cg2qRqDQdbyf6APBifaXKwUnWqwYjI5EqU3zAch92Hs3fX92M524ZuXSpDjydM e2IhVubq369wzFWnk08pFLx6VLDByQbS3qegikcPx4Ch/DRmJHYLwX6Fj9thHbt/Tr/Q OCNKIXGLWIuDDvINL0ARnURq6nLxFxHSUz8jx0o3TonA/1DykKOiCcxpAFUuSOSpYKAP 6JcvIXaHEDtGcE6Nd1lMX1j/YE/8e7p3VPrjEAZCE+GuHvfD0/mbSc8mjXCSjRlyE1Kv W6QpFR/U4qYJAaye9J4IA3U+hvr3CmQIoSIYGxx6rQ1yWeQtEFAmrne7aGZjZz0gF0EU 14/w== X-Gm-Message-State: ANhLgQ30rgMVA7Mt55rLhVsTS2Sa3sHpnddu7OQBMZaM/iqwOwSh2/xc k+mVl9SkZJaZFF7S5FQ6wUA/+Q== X-Google-Smtp-Source: ADFU+vvlna30QvcG3Z5HgbV2pZfGDro7Rul5FZq9ItMeRE3p0czgIINs9fQtDa0LG7T++0HlPXb3pg== X-Received: by 2002:adf:fd87:: with SMTP id d7mr30243703wrr.393.1584975056103; Mon, 23 Mar 2020 07:50:56 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id s22sm20376522wmc.16.2020.03.23.07.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 07:50:55 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Mon, 23 Mar 2020 15:49:41 +0100 Message-Id: <20200323144950.3018436-43-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200323144950.3018436-1-daniel.vetter@ffwll.ch> References: <20200323144950.3018436-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?= , Thomas Zimmermann , Daniel Vetter , Sam Ravnborg 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. v2: Use drmm_mode_config_init() for more clarity (Sam, Thomas) Cc: Sam Ravnborg Cc: Thomas Zimmermann Reviewed-by: Hans de Goede (v1) Signed-off-by: Daniel Vetter Cc: Hans de Goede Cc: "Noralf Trønnes" --- 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..3349f3c2a765 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 = 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;