Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3532801ybg; Mon, 28 Oct 2019 14:28:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaKqQej/DuNoODYu/V1i4mzWQlLW4qoO4r8p3GNiCswzPyfx+iSGPTvY8HElDo+4RtR8Qj X-Received: by 2002:a05:6402:213:: with SMTP id t19mr21988039edv.7.1572298110617; Mon, 28 Oct 2019 14:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572298110; cv=none; d=google.com; s=arc-20160816; b=krFwP5f0cBbtcK5+JTUD/HSJmFpX01mOP7wEPJw4LqBVLwkUm1TA/AaDCs5EsG6sE7 AQBitgCr4l5RzgcKn4HZw8O75KeHWZdujWVbaNJI2alslqsbYs22+ParkWBZLAOObFOA AnHPyyqaf9nl2bMtXgDPX/tQHyWOseUMPH3WdryXHmZBOgkPsUe6k4VZeDlqd+C+DVrP YPF2rg4gylPKEmRpIpbIcCzVLfQEkH77NfJtO+HEZrYi7xwUJ9zenxBXksz+SeUJpKaz gemtkxNyazJZLRgRjl2iYKEDdS6rLiJzhuBwM26ThK0RhCMIsEYpe9lCAjj4tZBLHJqm 7ATg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=I4Wjjd0ITUFs4S6xHVRWYN734oAvUfTk6zXy3J3erRA=; b=qyJOydkTXH10v10bZpuc8PRlEAuHkra1ualY4jqKIzi9YxKDmdycKB6euC0Y3JPfvP YlEpEiKWLDSV4lHCd9CVHr/KWreWBlw4EoJfuWV7dvcEvqGg8PvVlIRVis/0hGpsllVn RVxMfJxpw8hb4PddFFHVWD+FIanKWV6J5bk0BvVoNy9+oJpZKPw4zw9CumXgRMOZfHo9 io9iI6qLMXL5Xx7ldBvCO8uCqIaitS7S3MUTszXwh/4UVQDPm+ya3vlf2wnwluUG7H5p PxICirJ+5Enxc4tPeapAUQD8zqpcsf05S/KbO/4gd8ZZZQ04mZTcFnIXg2A3/SR+0bBe Ypgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m7si9738332eda.192.2019.10.28.14.28.06; Mon, 28 Oct 2019 14:28:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403984AbfJ1RBj (ORCPT + 99 others); Mon, 28 Oct 2019 13:01:39 -0400 Received: from mga02.intel.com ([134.134.136.20]:40367 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730463AbfJ1RBj (ORCPT ); Mon, 28 Oct 2019 13:01:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 10:01:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,240,1569308400"; d="scan'208";a="211488272" Received: from yoojae-mobl1.amr.corp.intel.com (HELO [10.7.153.148]) ([10.7.153.148]) by orsmga002.jf.intel.com with ESMTP; 28 Oct 2019 10:01:19 -0700 Subject: Re: [PATCH v2] media: aspeed-video: Fix memory leaks in aspeed_video_probe To: Navid Emamdoost Cc: emamd001@umn.edu, smccaman@umn.edu, kjlu@umn.edu, Eddie James , Mauro Carvalho Chehab , Joel Stanley , Andrew Jeffery , linux-media@vger.kernel.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20191028165827.24949-1-navid.emamdoost@gmail.com> From: Jae Hyun Yoo Message-ID: <6450dbb4-aa6f-627d-7e5d-21a20f560d60@linux.intel.com> Date: Mon, 28 Oct 2019 10:01:19 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191028165827.24949-1-navid.emamdoost@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/28/2019 9:58 AM, Navid Emamdoost wrote: > In the implementation of aspeed_video_probe() the allocated memory for > video should be released if either devm_ioremap_resource() > or aspeed_video_init() or aspeed_video_setup_video() fails. Replace > kzalloc() with devm_kzalloc to avoid explicit release for video. > > Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver") > Signed-off-by: Navid Emamdoost > --- > Changes in v2: > -- replace kzalloc with devm_kzalloc based on Jae Hyun Yoo > suggestion > > drivers/media/platform/aspeed-video.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c > index eb12f3793062..2aa8ea2f9824 100644 > --- a/drivers/media/platform/aspeed-video.c > +++ b/drivers/media/platform/aspeed-video.c > @@ -1646,7 +1646,7 @@ static int aspeed_video_probe(struct platform_device *pdev) > { > int rc; > struct resource *res; > - struct aspeed_video *video = kzalloc(sizeof(*video), GFP_KERNEL); > + struct aspeed_video *video = devm_kzalloc(sizeof(*video), GFP_KERNEL); It can't be compiled. devm_kzalloc should have 3 parameters. Cheers, Jae