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 29D9CC74A5B for ; Fri, 17 Mar 2023 04:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbjCQEZL (ORCPT ); Fri, 17 Mar 2023 00:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjCQEY7 (ORCPT ); Fri, 17 Mar 2023 00:24:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFAEA2330C; Thu, 16 Mar 2023 21:24:50 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 9B87FB82427; Fri, 17 Mar 2023 04:24:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6DE8C433EF; Fri, 17 Mar 2023 04:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679027088; bh=o+pPvZmLTTUnkEUT65ibeKDRJnFaZ+5SLIlSpL5yQiU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=spq3mnP12g7jIfqbpxoACTAekIO1P0RhO8jrf/DRzeUs5BlIXDl8iasOnq5bhQl26 mJc0LJo+uC7ijFJX3r0I6BwjksT5GC6Xs6jepDA46Gcx0Fij/aq3U5U6OnvBPHTup1 K+EFAU+E2UWgmH2pAperJqXDDtMFkzsEUZkJ1QGdNa4YrPXdPiHHJicYktHTF56i8B hAWmC2R6dtJL/n0PVVcvpbqaPaB/4IKfqcNCkhLg78gooGNep7e8Y8cqRSLRxAgP2a 5/G69jZzlLVJpEgxVd58vTcXV2p5Al+PL7tkRBLnipEwHNDZRfvkw7SG/hGtkflEJj KLX5wXlh9PIlw== Date: Thu, 16 Mar 2023 21:24:46 -0700 From: Jakub Kicinski To: Jiasheng Jiang Cc: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, richardcochran@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] octeontx2-vf: Add missing free for alloc_percpu Message-ID: <20230316212446.44c5a429@kernel.org> In-Reply-To: <20230316023911.3615-1-jiasheng@iscas.ac.cn> References: <20230316023911.3615-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 16 Mar 2023 10:39:11 +0800 Jiasheng Jiang wrote: > + if (vf->hw.lmt_info) > + free_percpu(vf->hw.lmt_info); > if (test_bit(CN10K_LMTST, &vf->hw.cap_flag)) > qmem_free(vf->dev, vf->dync_lmt); > otx2_detach_resources(&vf->mbox); > @@ -762,6 +764,8 @@ static void otx2vf_remove(struct pci_dev *pdev) > otx2_shutdown_tc(vf); > otx2vf_disable_mbox_intr(vf); > otx2_detach_resources(&vf->mbox); > + if (vf->hw.lmt_info) > + free_percpu(vf->hw.lmt_info); No need for the if () checks, free_percpu() seems to handle NULL just fine.