From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0BA1C433E2 for ; Fri, 11 Sep 2020 08:50:01 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 71B1820665 for ; Fri, 11 Sep 2020 08:50:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vMCXj25h"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Ov5mAc6C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71B1820665 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dG4qKmRUhrRoTGJz59QKkWxMN5TDzkxn/TyJ2sC8xCU=; b=vMCXj25hgkSDZMtbIEGDglQMC WNmlcc4jsB5cBxEoO9HanfhP3pN4nAwMYIxFodjy33JZukplZ0iT0cg9srSbBM7APsHqW/Q7HD7KH sDgsceBI2/Aub5AMRI63mZOgF42B/Eti+heOYMbk5AUR27EAvY5T8wNEAy92R3WUNcmkrUa53uW5L TGepglb5hft4SzSTmGUJ05gY11AaOtcWhUZoMBK+nf0kPB0DxxUe3Gx1s1ugENMP2dp4yMpNNVKld 60SAjzTTsSs1W4fsmfRyGBdXCVvr3MAOQIXclvNHyKDzeg5elG+av92/5YQLZNQDyvHHbvjQQeJb4 AgUwK1dPA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGeiu-0004X5-Lv; Fri, 11 Sep 2020 08:48:01 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGeiD-0004Hh-SL for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2020 08:47:40 +0000 Received: by mail-wm1-x343.google.com with SMTP id x23so3652693wmi.3 for ; Fri, 11 Sep 2020 01:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DvMPyj8qt4jHW/51wnfAjWdKajgYfQPiWAmb6Xy5N8U=; b=Ov5mAc6CKxy1ruYfZtdKD2aJn0yVjOs8IJqLy43pn+ZB0avc5vlU8MX19KYF1F5abf fKCNErmB99WLs5aZP85a90fNn9hXLMtPScllxEvtd0zvrxBpWd8tBGlNlz6skNnUZTUJ EKTGPxBfF24p43dIXjzz8H1O+D4LngZdcbl+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DvMPyj8qt4jHW/51wnfAjWdKajgYfQPiWAmb6Xy5N8U=; b=ZZFXuYvOJUG4crDb/6EdmRSgBr98JkccZgffX6AQbT2uxEwXRUZ6dwVMHZUFlq9LbF mCcOqf4fOw3nJVDAun5US75xodkBICP4y7sGveTawNHVaOQY2bJB6UYfvCmlusD9Aghb tMcgC/OYtBoCsNiOkTTDNbL8a6G1EAT7H2xhIIWpo6pbb7SUtgPIVbk2BLkoBI0bqjjL ZW9G0kZeoRbZ8wQ1NOkKhH47UIpffShBhB4ZE19eG//N7+M1/iXIwZM6XdRtq7F9a4RY EXu9YH/GMppZz3v+wIXDOVvyY/HOZP5NxihfMiHQ6vV7eB1ABdN9quiZ7Qt3PpM3iuaQ AzkQ== X-Gm-Message-State: AOAM531Fs1xNFp5GHjx2Iky4kOetiQ8k9BhGnLHbebUP9CG3BlMyImFC iqw+UB2lFwByIh9nw7hBIDgoyA== X-Google-Smtp-Source: ABdhPJyipNgbxSeMoX6NrRZx1OE3w2u3cJEppw47qQwDAyRcTPzaAITWyd+RoOQ6Ns6oHwlefjzrmA== X-Received: by 2002:a1c:2742:: with SMTP id n63mr1105455wmn.24.1599814035385; Fri, 11 Sep 2020 01:47:15 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id p11sm2935553wma.11.2020.09.11.01.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 01:47:14 -0700 (PDT) Date: Fri, 11 Sep 2020 10:47:12 +0200 From: Daniel Vetter To: Hyun Kwon Subject: Re: [PATCH] drm/xlnx: Use devm_drm_dev_alloc Message-ID: <20200911084712.GN438822@phenom.ffwll.local> References: <20200904143941.110665-7-daniel.vetter@ffwll.ch> <20200907082225.150837-1-daniel.vetter@ffwll.ch> <20200908191600.GA1569998@xilinx.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200908191600.GA1569998@xilinx.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200911_044718_108288_3C42C1F9 X-CRM114-Status: GOOD ( 29.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , DRI Development , Michal Simek , Laurent Pinchart , Daniel Vetter , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Sep 08, 2020 at 12:16:00PM -0700, Hyun Kwon wrote: > Hi Daniel, > > On Mon, Sep 07, 2020 at 01:22:25AM -0700, Daniel Vetter wrote: > > Gets rid of drmm_add_final_kfree, which I want to unexport so that it > > stops confusion people about this transitional state of rolling drm > > managed memory out. > > > > This also fixes the missing drm_dev_put in the error path of the probe > > code. > > > > v2: Drop the misplaced drm_dev_put from zynqmp_dpsub_drm_init (all > > other paths leaked on error, this should have been in > > zynqmp_dpsub_probe), now that subsumed by the auto-cleanup of > > devm_drm_dev_alloc. > > > > Signed-off-by: Daniel Vetter > > Cc: Hyun Kwon > > Cc: Laurent Pinchart > > Cc: Michal Simek > > Cc: linux-arm-kernel@lists.infradead.org > > Looks correct to me. > > Reviewed-by: Hyun Kwon Merged all patches up to this one here to drm-misc-next. -Daniel > > Thanks! > > -hyun > > > --- > > drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 27 ++++++--------------------- > > 1 file changed, 6 insertions(+), 21 deletions(-) > > > > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c > > index 26328c76305b..8e69303aad3f 100644 > > --- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c > > +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c > > @@ -111,7 +111,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub) > > /* Initialize mode config, vblank and the KMS poll helper. */ > > ret = drmm_mode_config_init(drm); > > if (ret < 0) > > - goto err_dev_put; > > + return ret; > > > > drm->mode_config.funcs = &zynqmp_dpsub_mode_config_funcs; > > drm->mode_config.min_width = 0; > > @@ -121,7 +121,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub) > > > > ret = drm_vblank_init(drm, 1); > > if (ret) > > - goto err_dev_put; > > + return ret; > > > > drm->irq_enabled = 1; > > > > @@ -154,8 +154,6 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub) > > > > err_poll_fini: > > drm_kms_helper_poll_fini(drm); > > -err_dev_put: > > - drm_dev_put(drm); > > return ret; > > } > > > > @@ -208,27 +206,16 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev) > > int ret; > > > > /* Allocate private data. */ > > - dpsub = kzalloc(sizeof(*dpsub), GFP_KERNEL); > > - if (!dpsub) > > - return -ENOMEM; > > + dpsub = devm_drm_dev_alloc(&pdev->dev, &zynqmp_dpsub_drm_driver, > > + struct zynqmp_dpsub, drm); > > + if (IS_ERR(dpsub)) > > + return PTR_ERR(dpsub); > > > > dpsub->dev = &pdev->dev; > > platform_set_drvdata(pdev, dpsub); > > > > dma_set_mask(dpsub->dev, DMA_BIT_MASK(ZYNQMP_DISP_MAX_DMA_BIT)); > > > > - /* > > - * Initialize the DRM device early, as the DRM core mandates usage of > > - * the managed memory helpers tied to the DRM device. > > - */ > > - ret = drm_dev_init(&dpsub->drm, &zynqmp_dpsub_drm_driver, &pdev->dev); > > - if (ret < 0) { > > - kfree(dpsub); > > - return ret; > > - } > > - > > - drmm_add_final_kfree(&dpsub->drm, dpsub); > > - > > /* Try the reserved memory. Proceed if there's none. */ > > of_reserved_mem_device_init(&pdev->dev); > > > > @@ -286,8 +273,6 @@ static int zynqmp_dpsub_remove(struct platform_device *pdev) > > clk_disable_unprepare(dpsub->apb_clk); > > of_reserved_mem_device_release(&pdev->dev); > > > > - drm_dev_put(drm); > > - > > return 0; > > } > > > > -- > > 2.28.0 > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel