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=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 4044AC0650F for ; Thu, 8 Aug 2019 12:29:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13CC5204EC for ; Thu, 8 Aug 2019 12:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565267350; bh=6jzux0+2vvckRewHmMdUXtSlDgM4FNrOY4r8OF3oAc4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=T6L9bmiDyK4y97+nR/8niPBLB7FtuOPSiu0OYIMUWC1xUVrhp691Ga669zDMtw3oh vc1iP5Vg8S4vSlsXrsGQnTpDwAjOMhHhrYmFRoz72rzXyb0iSpA3e8OTWEqj8mZP1B xpU1xLFvgNU/DOFk9wlLimwOYAyPsDAmGPQ4ZWcA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728825AbfHHM3J (ORCPT ); Thu, 8 Aug 2019 08:29:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:43242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbfHHM3J (ORCPT ); Thu, 8 Aug 2019 08:29:09 -0400 Received: from localhost (unknown [122.178.245.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B339C204EC; Thu, 8 Aug 2019 12:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565267348; bh=6jzux0+2vvckRewHmMdUXtSlDgM4FNrOY4r8OF3oAc4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rQ2IIjOdyPZYz8p/n9UOdJfzjP5Ie4l9sLrtdN1AbNjOBzXz6Uv6nztj9w/rA+zxe CZ5C1s2KkedVvmuGExd9Yj8FSPfYWe+w9BYnxy3qUB3lWuXMqnDMmTyWp6PeqwJyQk CtOVSp1HQ0KTpZlA6coKRkcdIXsC9slMOaPApKQI= Date: Thu, 8 Aug 2019 17:57:56 +0530 From: Vinod Koul To: Sinan Kaya Cc: Nishka Dasgupta , agross@kernel.org, dan.j.williams@intel.com, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org Subject: Re: [PATCH v2] dma: qcom: hidma_mgmt: Add of_node_put() before goto Message-ID: <20190808122756.GS12733@vkoul-mobl.Dlink> References: <20190724081609.9724-1-nishkadg.linux@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org On 24-07-19, 13:25, Sinan Kaya wrote: > On 7/24/2019 4:16 AM, Nishka Dasgupta wrote: > > Each iteration of for_each_available_child_of_node puts the previous > > node, but in the case of a goto from the middle of the loop, there is > > no put, thus causing a memory leak. > > Hence add an of_node_put under the label that the gotos point to. > > In order to avoid decrementing an already-decremented refcount, copy the > > original contents of the label (including the return statement) to just > > above the label, so that the code under the label is executed only when > > a goto exit from the loop occurs. > > Additionally, remove an unnecessary get/put pair from the loop, as the > > loop itself already keeps track of refcount. > > Issue found with Coccinelle. > > > > Signed-off-by: Nishka Dasgupta > > nit: please post v3 with dmaengine:qcom:hidma_mgmt:.... > > Vinod doesn't like commit subjectss in this directory to have dma name > on it. You can keep my acked-by. That's right but I am okay to hand edit while applying for drive by contributors :) so applied with you ack > Acked-by: Sinan Kaya > -- ~Vinod