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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDCE8C433FE for ; Thu, 10 Nov 2022 07:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232343AbiKJHC4 (ORCPT ); Thu, 10 Nov 2022 02:02:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbiKJHCz (ORCPT ); Thu, 10 Nov 2022 02:02:55 -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 BD7842250A; Wed, 9 Nov 2022 23:02:54 -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 5160D61D7F; Thu, 10 Nov 2022 07:02:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC9EFC433C1; Thu, 10 Nov 2022 07:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668063773; bh=c67wxQgkF8UYfaGU9UNy+6DAoMPvP8sl9I7jtOccIh8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=heV0AzmQL9bI7hPyjVlD00ezQQvqmjQCP3ZS3MwciDI+ipZ/tZBD6/u3j2BljmVQx eJusoL9JoyI5QkhW8CEKG58gieAQHFYLnAF8+D/4S2f3JykMqYTOXPgX/JZMGI5kpc JFTL0IkJQkDo+GUGd34/MM3b164w8Ycd4LOngosrtlI5Zh+rbU8tT1PhGzlqjEXfPA 6I3z+bpPAcxQWkuAIqWhMz6Tnq+bIxMPJn+Y4HgrNqt9/M5tdsjwolT8VbYKjqyuAD EL97KQ/UpP4ZjsW8O5K8u6u0trtvFH70MFi0U37ZENhDflXK0HQctuDRYl1rsVilvU 9QN1Q66fpyyvg== Date: Thu, 10 Nov 2022 12:32:49 +0530 From: Vinod Koul To: YueHaibing Cc: vincent.sunplus@gmail.com, kishon@kernel.org, linux-usb@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] phy: usb: sunplus: Fix memleak in update_disc_vol() Message-ID: References: <20221108073430.29172-1-yuehaibing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221108073430.29172-1-yuehaibing@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On 08-11-22, 15:34, YueHaibing wrote: > 'otp_v' is allocated in nvmem_cell_read(), it should be freed > before return. Right! > > Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021") > Signed-off-by: YueHaibing > --- > v2: free otp_v before return > --- > drivers/phy/sunplus/phy-sunplus-usb2.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c > index e827b79f6d49..62d5cb5c7c9d 100644 > --- a/drivers/phy/sunplus/phy-sunplus-usb2.c > +++ b/drivers/phy/sunplus/phy-sunplus-usb2.c > @@ -105,6 +105,9 @@ static int update_disc_vol(struct sp_usbphy *usbphy) > val = (val & ~J_DISC) | set; > writel(val, usbphy->phy_regs + CONFIG7); > > + if (!IS_ERR(otp_v)) > + kfree(otp_v); But that is not the case! -- ~Vinod