Message ID | 20221107210438.1515-3-Sergey.Semin@baikalelectronics.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2303744wru; Mon, 7 Nov 2022 13:24:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM4AKieHD/jtkrxiwR4L6FLeFY2nLfGAYM7I1d8If9t8MLzXlrnE8AA4r4vIBjoK/mQKnAKd X-Received: by 2002:a05:6402:5409:b0:44f:1e05:1e8 with SMTP id ev9-20020a056402540900b0044f1e0501e8mr52500556edb.373.1667856251320; Mon, 07 Nov 2022 13:24:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667856251; cv=none; d=google.com; s=arc-20160816; b=kG5trb4hFh8l8ecp1LR58hUbh2IKADDmDN2W2lUQ/fvlUrQkx/bh1ax7T0Y5Rybbqa o82WYMxSAiK33uF9tUOVKQvzlCNXkHBxZPU0pqeoANGpt8McMRSaJwTVmGa26FoO4lZ3 hfSYjxIJKXruKg3jM6kEx5yRARXh1GCl3Y0BQ5atdy1CNxtbBZxFl2cc4ORzdz6PLbgS wMZZpJY2XPHUcMik3aJrLlQgW8rQ8B6fm88/7bpE9WogzwrYfZHDVnpWHJMlsl0lvrCr YNQ+zlaAHAab3FwOPGEals69rkziPY1SvXdBlbSwQmd369EE+DmJkdWYeq2pndhRIBtk 074g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dHUTIza7SlJbIGU8HS4l4Y7B/K1DiYT1tSK1KgzAgns=; b=MM0Lp/UT+fvWY+E30hokQtO+rIikZH8xHaB3mmeeI9Ot8kgGgzpH1LX5IrLI9PS9vb bueJbI9ycX+V60u6imFabHBKL9mn4nNlUKjSg4mZtUGdNtYn5qw4x1/H0JmmLVtIw0DN v7owJtuFiPsAyFxiHqF73WcaGFAjv9wFS1ujN/yMgB6HYcRUE45Sle/iTJ2r7yMZO4CF 5cHR9C84wTtlgd38zXh+zdxDnNZjaQRJen/GRaftp3rl57TwFrbapr7HNGvgQNgWRI8o TlEsOWcQ5z1XkXldFOgUdQt3kvcEH7RjDimSDpodq/oZGGTjmOdTSgjB42pYRR5vD8BL NCzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=OlyiKAHj; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a0564021e9200b00463c5c32c65si12871593edf.457.2022.11.07.13.23.47; Mon, 07 Nov 2022 13:24:11 -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=@baikalelectronics.ru header.s=post header.b=OlyiKAHj; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233371AbiKGVOb (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 16:14:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233397AbiKGVOJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 16:14:09 -0500 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92E8F3F050; Mon, 7 Nov 2022 13:11:05 -0800 (PST) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id AD957E0ECB; Tue, 8 Nov 2022 00:04:45 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=dHUTIza7SlJbIGU8HS4l4Y7B/K1DiYT1tSK1KgzAgns=; b=OlyiKAHjLmpp 5AGXmfx/PeDm2X2hbJa08gmN1kKh7MbMJTKj4yDi3TZI2Dm+wLVEvvglyI3hVpYC ih7jBhL7OB2Sd3OeVEulOg4v7akLtVcNW46+pkC7ch+0ssiTXF3VfI0ZxKI1nbBT 1CIkRlC0rLYRbWkLEiC8PSocZ2lNQv4= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 9C780E0E6A; Tue, 8 Nov 2022 00:04:45 +0300 (MSK) Received: from localhost (192.168.168.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 8 Nov 2022 00:04:44 +0300 From: Serge Semin <Sergey.Semin@baikalelectronics.ru> To: Gustavo Pimentel <gustavo.pimentel@synopsys.com>, Vinod Koul <vkoul@kernel.org>, Rob Herring <robh@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Cai Huoqing <cai.huoqing@linux.dev>, Robin Murphy <robin.murphy@arm.com>, Jingoo Han <jingoohan1@gmail.com>, Frank Li <Frank.Li@nxp.com>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> CC: Serge Semin <Sergey.Semin@baikalelectronics.ru>, Serge Semin <fancer.lancer@gmail.com>, Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>, Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= <kw@linux.com>, caihuoqing <caihuoqing@baidu.com>, <linux-pci@vger.kernel.org>, <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Gustavo Pimentel <Gustavo.Pimentel@synopsys.com> Subject: [PATCH v6 02/24] dmaengine: dw-edma: Release requested IRQs on failure Date: Tue, 8 Nov 2022 00:04:16 +0300 Message-ID: <20221107210438.1515-3-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221107210438.1515-1-Sergey.Semin@baikalelectronics.ru> References: <20221107210438.1515-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [192.168.168.10] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748874036298462811?= X-GMAIL-MSGID: =?utf-8?q?1748874036298462811?= |
Series |
dmaengine: dw-edma: Add RP/EP local DMA controllers support
|
|
Commit Message
Serge Semin
Nov. 7, 2022, 9:04 p.m. UTC
From very beginning of the DW eDMA driver live in the kernel the method dw_edma_irq_request() hasn't been designed quite correct. In case if the request_irq() method fails to initialize the IRQ handler at some point the previously requested IRQs will be left initialized. It's prune to errors up to the system crash. Let's fix that by releasing the previously requested IRQs in the cleanup-on-error path of the dw_edma_irq_request() function. Fixes: e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Acked-by: Vinod Koul <vkoul@kernel.org> --- Changelog v2: - This is a new patch added in v2 iteration of the series. --- drivers/dma/dw-edma/dw-edma-core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index c54b24ff5206..a8c1bd9c7ae9 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -893,10 +893,8 @@ static int dw_edma_irq_request(struct dw_edma *dw, dw_edma_interrupt_read, IRQF_SHARED, dw->name, &dw->irq[i]); - if (err) { - dw->nr_irqs = i; - return err; - } + if (err) + goto err_irq_free; if (irq_get_msi_desc(irq)) get_cached_msi_msg(irq, &dw->irq[i].msi); @@ -905,6 +903,14 @@ static int dw_edma_irq_request(struct dw_edma *dw, dw->nr_irqs = i; } + return 0; + +err_irq_free: + for (i--; i >= 0; i--) { + irq = chip->ops->irq_vector(dev, i); + free_irq(irq, &dw->irq[i]); + } + return err; }