Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4917203pxb; Wed, 26 Jan 2022 00:08:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJeOgEBT0++F+0cXID2JZoszoP+btyYJ4TYcRWVvfWToCH3NwpsWYAPeJtOBxIi0lxYdaa X-Received: by 2002:a17:906:4ccb:: with SMTP id q11mr19299940ejt.398.1643184526756; Wed, 26 Jan 2022 00:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643184526; cv=none; d=google.com; s=arc-20160816; b=AkAAoBXsUUnvwrrdjZAlfHarOMwqvDnOyPjmpy4i3AnLAeX0KEZA7nxJU1jgPveG0J SL/7MGRC2mZljlWlkUG1G/k8Y5T97lyiBiWfLDxSIMvChkSQzGApGreDW6Qi37GqHb/3 f1Uh7s1J7Ta8UTMzgyQqj9FIqENzuqy//80MqmHoJpAVZPlAPcDX/kMyM8+KFalh4k8m lmDg6S31bnWHhY3lOIAXk9TzJ/jBq5FUWxaV7iDy6jghPHx/7QRMznPi4IcA98oPwMXa +B8xBocMo4RfsfE6rTeT9PHNxF1dP1qEzXwKQutLkDijM0mW1etE83V+LtmPHV7XBdDy 8suQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=to0dr0B+o3Pe3roPhwDHepr1yH1PCTwW4YVe/nAKK+M=; b=c/GO1Ikb9sjqVbDvmeEB2K298Ik1m6J4f9jBhoxxElhxdO2e16zXgDef4bdVLJj0fs OOJDpuKicTZ9ggYigayH5vZdcP/D/lj3vhNSNAQUQM9vDZfF9t0yjB+mlViGgvprmWZA WibgptR74LEy5vHiKxeh8hp6+vcfrwfSQnyGMimpLT0xymMDP964p/IrnAI/az5PuYoO Rmd+3zsKJq5I0dE/HPsC437RefSw+B+gcopIqDtuflCsdhtmgfjwFYam/9BllG9EGpAY dDhb7nx8FY5V3H9n3urZyeFsVxS7v9aOSuw8jRckKX9fcBpB3HGz/+ndCgIojlJAYRQv eBpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sizI92II; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si12729404ejt.122.2022.01.26.00.08.21; Wed, 26 Jan 2022 00:08:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sizI92II; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbiAYTcx (ORCPT + 99 others); Tue, 25 Jan 2022 14:32:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiAYTcw (ORCPT ); Tue, 25 Jan 2022 14:32:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24255C06173B; Tue, 25 Jan 2022 11:32:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0F046169A; Tue, 25 Jan 2022 19:32:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90B6FC340E0; Tue, 25 Jan 2022 19:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643139170; bh=eh3SDUBzbO+RbsUX4b5YjlEDOizdj2B3kgbhAZIXSfQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=sizI92IIcGhp94GfX0j81qNxn0adzGZLubYK4f270Nz1HqSO7AEFBhb3WpFuh3Rg3 vBQ+3nsV9YYHMAkDeohZJXh+P6TCtYuxj1kXYmaxoq3hCGTlcTsIBGWD0c9lmu9h7L T8rg3fYfXfzgQSf9rOp7iEFzGudAZY+8MkncaokHcYW/tcpp6XnKgebkVXJcd0zXmv etwLItN0BHhvdetBwk2mAXpbFSCYcM0/vNs0HkJOC1j6hN3dKgR7OjUbWOnz1NwC5U RSdokmIHCTI2S4NxVcmYgUIvrP9oLDYI9Li8JV/9muFjnS7cnrk7ose6SM5D8d8eDV 6iNkqJhMVK18w== Message-ID: Date: Tue, 25 Jan 2022 13:32:48 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] clk: socfpga: Fix a memory leak bug in socfpga_gate_init() Content-Language: en-US To: Stephen Boyd , zhou1615@umn.edu Cc: kjlu@umn.edu, Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220124165316.55449-1-zhou1615@umn.edu> <20220124195341.50C97C340E5@smtp.kernel.org> From: Dinh Nguyen In-Reply-To: <20220124195341.50C97C340E5@smtp.kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/22 13:53, Stephen Boyd wrote: > Quoting Zhou Qingyang (2022-01-24 08:53:16) >> diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c >> index 53d6e3ec4309..0ca5e0000925 100644 >> --- a/drivers/clk/socfpga/clk-gate.c >> +++ b/drivers/clk/socfpga/clk-gate.c >> @@ -188,8 +188,10 @@ void __init socfpga_gate_init(struct device_node *node) >> return; >> >> ops = kmemdup(&gateclk_ops, sizeof(gateclk_ops), GFP_KERNEL); >> - if (WARN_ON(!ops)) >> + if (WARN_ON(!ops)) { > > A WARN_ON() after an allocation failure will lead to double stacktraces. > Can you remove the WARN_ON()? > > Furthermore, it looks like 'ops' is never freed on failure in this > function. Did the SA tool figure that out? There are more problems with > this function and error paths. Seems like nobody cares. > Thanks for pointing this out. I'll take a look and will send a patch shortly. Dinh