Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752002AbdIULYv (ORCPT ); Thu, 21 Sep 2017 07:24:51 -0400 Received: from mga03.intel.com ([134.134.136.65]:7794 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751593AbdIULYs (ORCPT ); Thu, 21 Sep 2017 07:24:48 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,425,1500966000"; d="scan'208";a="1197544724" Date: Thu, 21 Sep 2017 14:24:43 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Arvind Yadav Cc: thierry.reding@gmail.com, airlied@linux.ie, jonathanh@nvidia.com, daniel.vetter@intel.com, jani.nikula@linux.intel.com, seanpaul@chromium.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH 2/2] drm: Release memory obtained by kasprintf Message-ID: <20170921112443.GH4914@intel.com> References: <1505892308-6843-1-git-send-email-arvind.yadav.cs@gmail.com> <1505892308-6843-3-git-send-email-arvind.yadav.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1505892308-6843-3-git-send-email-arvind.yadav.cs@gmail.com> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1072 Lines: 36 On Wed, Sep 20, 2017 at 12:55:08PM +0530, Arvind Yadav wrote: > Free memory region, if drm_crtc_init_with_planes is not successful. > > Signed-off-by: Arvind Yadav > --- > drivers/gpu/drm/drm_crtc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index 5af25ce..cd4e628 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -328,6 +328,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, > ret = drm_crtc_crc_init(crtc); > if (ret) { > drm_mode_object_unregister(dev, &crtc->base); > + kfree(crtc->name); Looks correct. However my ocd would wish the kfree() to precede drm_mode_object_unregister() to make the unwinding mirror the allocation/registration sequence. > return ret; > } > > -- > 1.9.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrj?l? Intel OTC