From patchwork Tue Nov 29 16:36:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 27337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp447673wrr; Tue, 29 Nov 2022 08:42:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+YHEO6g+tnoFXJAxhr1errqcpH2LRuoSyKSsbLKnFFpGhspGLLQgv6rZPRn43ejOmmO9w X-Received: by 2002:a17:906:3155:b0:7ad:90db:c241 with SMTP id e21-20020a170906315500b007ad90dbc241mr48603573eje.284.1669740154469; Tue, 29 Nov 2022 08:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669740154; cv=none; d=google.com; s=arc-20160816; b=uJu/qVc8aMhSIueBJ+0F5XMtsM8rXYLrVSHuA3TN4eUn6w5d8ff1itpu/n+5FN59/f m79dC2OkmhBuQsOufNmIzIfQhLPBvs+kR0HmyJh/med96MfdhRInlvH8hXG0dRo38lPW M5IP5PV01jFPA5LN6Pk7exW34fKgsWTK4z1ZMtKmGxz12EzSEzvsBA1ghRCJvmSJhUaa mNMn8M7/cMU3+sdBeL8H5aTWZHuQ66benw/BOm6hdB6tkiCApyqkO0AD1nWrSIX6J6Em g13HdlKES00dwTxvY1+LrTfT45MKUjrNGBAoZpe5byl5ZFQMEmRCkcYmuDLmnHpMCwBG DKlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=X7gU7iyXBSFQBvNjvw/UcvRrA8XlO59KBkwk0dMHnyk=; b=riC13xT4lt8dzG+cZ1CBQAMuhCOFrkwPqcrcirqogcoyEl4PTvBk5zUaw42Wu/7qnI knZnzMV453ZbG5jryZK+Bxm+OFi39vO3X2/OYtH1BOtec+FrFOcwyqQ0knDnACbPLTAf sTLYaXqL/89/9DTxyhQm9Ey5Z4HO/DDnho+Q1McU2cXzYvJmHqK/67yxjvpEiT/m3URD hLpH+4yUJN86J2KXJRo2WKqhr+QtPXdSZZ9oOMFuOQPQGa4VKuUmLl9eBy+RQQSPsE/9 EQjF/dZ3J/ZfcrtHifpZUkQIhVGyOT2BHqx4pEJCoYX4lr9oe1RQ5MvOsp64nL1hpF3i b3SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bRL2syn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq13-20020a1709073f0d00b007ad8218ad7fsi10066347ejc.379.2022.11.29.08.42.11; Tue, 29 Nov 2022 08:42:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bRL2syn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235796AbiK2QgR (ORCPT + 99 others); Tue, 29 Nov 2022 11:36:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235736AbiK2QgP (ORCPT ); Tue, 29 Nov 2022 11:36:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B68CE697E5 for ; Tue, 29 Nov 2022 08:36:14 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5A762B816BF for ; Tue, 29 Nov 2022 16:36:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68385C433D6; Tue, 29 Nov 2022 16:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669739772; bh=XEJdCEdAAXPGW69UsV4pHOCIbF31aUsqhM+l+I8Eo6w=; h=From:To:Cc:Subject:Date:From; b=bRL2syn7n3vxcXFEkGirUFy02FH8wldby2m6SAFhSmnMWz7qVPIyjGg4nA6944Xmf rJbL7JYo3DHyauXLkRK7UhycxG2Sw2RRe2Ptc1oI5eQR8f6/iiZ6pSOP23NTh90rKD SdxU2ax6bRjuTTV5Rq6N23mRPAjzgZlKiJ6krDcALLcqOKr/hZwhsj5TwMco1FHOkx /t0zwonY2YacElW+30qH7Epdkjwum+ropXjNuEkUXV+PA4NAv/RKk2JrsXs+b/jrwD Qvhhz8FPTLAk+EKIP8sCPNUW9PKuasgzzMNn8tajIdFdDgY7I8xLRGCfPF/CdaHi1w eJi+d154FU1rA== From: Dinh Nguyen To: gregkh@linuxfoundation.org Cc: dinguyen@kernel.org, linux-kernel@vger.kernel.org, Yang Yingliang Subject: [PATCH 1/2] firmware: stratix10-svc: add missing gen_pool_destroy() in stratix10_svc_drv_probe() Date: Tue, 29 Nov 2022 10:36:01 -0600 Message-Id: <20221129163602.462369-1-dinguyen@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750849452609723625?= X-GMAIL-MSGID: =?utf-8?q?1750849452609723625?= From: Yang Yingliang In error path in stratix10_svc_drv_probe(), gen_pool_destroy() should be called to destroy the memory pool that created by svc_create_memory_pool(). Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver") Signed-off-by: Yang Yingliang Signed-off-by: Dinh Nguyen --- drivers/firmware/stratix10-svc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index b4081f4d88a3..1a5640b3ab42 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -1138,13 +1138,17 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) /* allocate service controller and supporting channel */ controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); - if (!controller) - return -ENOMEM; + if (!controller) { + ret = -ENOMEM; + goto err_destroy_pool; + } chans = devm_kmalloc_array(dev, SVC_NUM_CHANNEL, sizeof(*chans), GFP_KERNEL | __GFP_ZERO); - if (!chans) - return -ENOMEM; + if (!chans) { + ret = -ENOMEM; + goto err_destroy_pool; + } controller->dev = dev; controller->num_chans = SVC_NUM_CHANNEL; @@ -1159,7 +1163,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) ret = kfifo_alloc(&controller->svc_fifo, fifo_size, GFP_KERNEL); if (ret) { dev_err(dev, "failed to allocate FIFO\n"); - return ret; + goto err_destroy_pool; } spin_lock_init(&controller->svc_fifo_lock); @@ -1221,6 +1225,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) err_free_kfifo: kfifo_free(&controller->svc_fifo); +err_destroy_pool: + gen_pool_destroy(genpool); return ret; }