From patchwork Mon Oct 4 10:09:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 12533639 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F85BC433EF for ; Mon, 4 Oct 2021 10:12:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14A7E61207 for ; Mon, 4 Oct 2021 10:12:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 14A7E61207 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LLVpXGcqEZN61+Hp3hGFStHFwbHC0aLh46awNJq4hmg=; b=kHbC2xr940HrR2 Bo/UGJrF7l21oOt5Mx8Q3VZ9mctzM+UcNZhEjbP/jFkoMDRreezYTvTVKVG2NrR/oEaL1GPmMLtmc 3ajGdmknUA4mPsg5eI5q8pEh2S00UE3lqxqNVjQB4zL4Lcu4CHSyznubxbn1i9rg7prqYVZuyTKqO xmjS+KwgYjQQvZXuZVaGp3B/UdCNyiLQVtzzkkPZigSPEyweaw9Wa8WG7Z3j163crwPyQKZDhVC1O 9GJwAIsG5xsZPmmENszIVtBstmwRGfAfzu8aF0nzMsiBIQzeLzVBSlTxU98yAEdWQEcBeOtxZ2d2c gP6l2LKHBKEc6Z3nMd7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXKvJ-005vxb-Dh; Mon, 04 Oct 2021 10:10:17 +0000 Received: from mail-eopbgr60087.outbound.protection.outlook.com ([40.107.6.87] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXKvE-005vtw-5x for linux-arm-kernel@lists.infradead.org; Mon, 04 Oct 2021 10:10:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X9AX0c49YyXKM/H2Rj4nSDWtL/lrsxskh+JmBtwoCZWQzctBqD8d99GgFa5CtUygolM/HJTF4Wy77tpu8byI6VTEITrq9LnHGsD/G7qaoJ3lpVA2WUkQQYC8dxEEN54na08/chzE1miIklqcEjd0n9xY0BUGrpLv3SwytzNRHo2JV7C0dDYGy/AVnahyqpSYuENTf38GZLaFA+uP4wLcpsNeaynI0Ev0kdP2ZsPSAyZ1bQtlr7K+Gh7/MW2xJjgnPz7mMxMZSfqGbNW6wnibX9jTrTrZ3eglLnJAqjWOzl1DBOJeIvXMqVusVladNNKH7E3ZHZCUbvbE/h7auW5oPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/TWVKMKSYP2z/IW+ova1SkKb88LKs9dC/45cSQ1gTKw=; b=B5s0ptQ9s4l+Z0Ejl0j0G4eSr58Olspt2NacDfJjCDoV/7YB3SYSRzxkOKGwQw9sYe8NZ+gxaWqmLkjvu2gGfJsMEsMQ6CRQetcWG/KTFAyYrc+drS1qDeqxOyWR/pZwoYhvJPzzbt52sucshRsXV4T16yf2Cz446m3OPPynUg4raQu+1pa1i27SB/mPpXOFxcPVWY1pvXbGJf6K5wesdQjpiV7Wyw+nhYi34seMy2WycbYpfno/O1dgDKUiZieZXXOQjINhzzN2GRZ/B64zweOEvpdzMchgrj5bywORU3rg4UUv25PxfMkh3xQoPzNAOkzlkXt6rIE4vKWet3mikw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/TWVKMKSYP2z/IW+ova1SkKb88LKs9dC/45cSQ1gTKw=; b=Wp/aDLAfBQPUS+3eVvdg5Xgu4lmD5VuzW9mLVFt/NHCd+c9gPixHbnba6QwlKhNe4SBQxI++C6bFbe1Y2vbwScnQxnIWzE8+3zL6j7x8tTqKV2SCcGIrImMI97lOfT7ZcvktocQtuaOBjXhaih+Rkneleaa9XBBs9oWjloIv2r0= Authentication-Results: lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR0402MB3405.eurprd04.prod.outlook.com (2603:10a6:803:3::26) by VE1PR04MB7231.eurprd04.prod.outlook.com (2603:10a6:800:1a9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15; Mon, 4 Oct 2021 10:10:05 +0000 Received: from VI1PR0402MB3405.eurprd04.prod.outlook.com ([fe80::e948:b382:34fc:c923]) by VI1PR0402MB3405.eurprd04.prod.outlook.com ([fe80::e948:b382:34fc:c923%7]) with mapi id 15.20.4566.022; Mon, 4 Oct 2021 10:10:05 +0000 From: Laurentiu Tudor To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: leoyang.li@nxp.com, youri.querry_1@oss.nxp.com, ioana.ciornei@nxp.com, Laurentiu Tudor Subject: [PATCH] soc: dpio: fix cleanup on error Date: Mon, 4 Oct 2021 13:09:44 +0300 Message-Id: <20211004100944.15023-1-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: AM4PR0501CA0063.eurprd05.prod.outlook.com (2603:10a6:200:68::31) To VI1PR0402MB3405.eurprd04.prod.outlook.com (2603:10a6:803:3::26) MIME-Version: 1.0 Received: from fsr-ub1864-101.ea.freescale.net (92.120.5.2) by AM4PR0501CA0063.eurprd05.prod.outlook.com (2603:10a6:200:68::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Mon, 4 Oct 2021 10:10:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 664f360b-dcab-47ae-be40-08d9871f2322 X-MS-TrafficTypeDiagnostic: VE1PR04MB7231: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: srzVxjQXvyOkyNf5Kk6LY7IuOaUW625tzBY3YR8DL4+Q/OxpNGblgiL8upY346jHLxaMy6BokFLdzpeciurL5JEoBVH5LjMi1n3CSErTAMlDe4oteucgqU0+1LkLyMA8ComGcXDBIqoVerG3kANVhM1KkDCpqV2gc/kpTHvSBN+37/Hby/NkffXZLXXTBx8bQ/Mc1uZw5EmwzbiX++dKnwQonDLtChPnuc22I1SD6TSYoqG8AhNTfUPyNLQ7m493DMfR3fYMgGKXuO71H3j5IjIkuRZ0V5yHedBnnM1p6JRiStxNDYp4rNXutt1wNfED0nIBuE+mPc9PfTu5FK771wxmEkb5BKiknP/LUZxIokXFmPN/ggCOwpE58v52WOlJogB/dFBQiTdWXDHoYCIXoHyxEyjLEP0HBUp4x4dg01lAyZgj6i7g/BTZcKdxwG+AI6HyVw8kr28wAjL+jEi/GbExmD9B4zIMG4b1aguC8mr9fZnCGYz6V8LFg08rIXSfgPGUWUV48MSyyybNECAFglcmpWJQFktENxXpqdmTJb9R/SAtNTusNnu5In3oBdY9SGtKYyBNzlDz6NfH1I1UKpqC6J+BnaU0lii+IVNExiScA3RyV7iRfcPUc0PFhscRUGWwW6mzl75EqKkJ6dNE9n6qthiLnr6KzmKS63SlFEt84rPkzIy7kbYki3+AxuOQvITx0P6w6fKXOvMjVbRkEA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0402MB3405.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(2906002)(83380400001)(26005)(6506007)(86362001)(4326008)(36756003)(52116002)(8676002)(44832011)(66946007)(5660300002)(66476007)(66556008)(6512007)(1076003)(38350700002)(6666004)(508600001)(316002)(38100700002)(8936002)(956004)(2616005)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XNj0E7tNmF6BEkYD1RhwXyuFMGrkA0+aJW3lu8ILnujoV/Xfh4M6lNOiZckS7AsV5ZSCns2XjeDs155ySgl3qjuUDnpYyjySzr/XaifFqBoOdYz6cJT+CwlC21MhyCp9qeYMD62gYLjE2pcLXHG/Kmvl71iTDQ5DOpwYuHRUh4fMXl3j5CNHgNVkFQzPUFF13EEhvbNRVPjkM56MLm9StRkXaGSBvjHCKSBLH0KgBewbPISQCkGUT6b40eLFXIqGQ8FJjmdI7w+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OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 664f360b-dcab-47ae-be40-08d9871f2322 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3405.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2021 10:10:05.5139 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: osW5x01sp3VVgwp0FJ9inDx03PF4U7Ef3LuX+BkPWuvGp2SkkWYn5p2su3MZOg0Ri0OhfItfW6zbvEOlKigiMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7231 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211004_031012_247361_7FD40EFF X-CRM114-Status: GOOD ( 11.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dpaa2_io_service_register() adds an element to a linked list but doesn't remove it on the error path, leaking it. Fix it. Signed-off-by: Laurentiu Tudor --- drivers/soc/fsl/dpio/dpio-service.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/soc/fsl/dpio/dpio-service.c b/drivers/soc/fsl/dpio/dpio-service.c index 7351f3030550..b42367eb1653 100644 --- a/drivers/soc/fsl/dpio/dpio-service.c +++ b/drivers/soc/fsl/dpio/dpio-service.c @@ -278,10 +278,20 @@ int dpaa2_io_service_register(struct dpaa2_io *d, spin_unlock_irqrestore(&d->lock_notifications, irqflags); /* Enable the generation of CDAN notifications */ - if (ctx->is_cdan) - return qbman_swp_CDAN_set_context_enable(d->swp, - (u16)ctx->id, - ctx->qman64); + if (ctx->is_cdan) { + int ret; + + ret = qbman_swp_CDAN_set_context_enable(d->swp, (u16)ctx->id, + ctx->qman64); + if (ret) { + spin_lock_irqsave(&d->lock_notifications, irqflags); + list_del(&ctx->node); + spin_unlock_irqrestore(&d->lock_notifications, + irqflags); + + return ret; + } + } return 0; } EXPORT_SYMBOL_GPL(dpaa2_io_service_register);