From patchwork Sat Jan 18 15:51:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13944206 Received: from smtp.smtpout.orange.fr (smtp-69.smtpout.orange.fr [80.12.242.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7A72273F9; Sat, 18 Jan 2025 15:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737215484; cv=none; b=u1UQ4Oam1xEtBYoaW68WvJAccgGh9f0iuDrCTa3zt1JHGeNazmuHBNdC2m0qwvMYXzxuDl2uRlUKbik3hZQKCqhz22FO9rjoZ12nuQRCar+/DAOcYhqto01uGdN8pWtm0la8SXpMOyBLS3EHG3vWQjc8tEZYKgthwRxbzcfzRqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737215484; c=relaxed/simple; bh=/lyRBA3Zy7BHX9j5/Yd+fA4f0AbOSlx3mF5PTWtDtjo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=R37sZrdOgjzUtajU4d5XTnacl283ZTtD9aMt2vPdzFGlpoS09sRTc3/C2+JRxYm//AllhBh4MxdxejE0ZiAG/N2Ltbgvu46tklzWsRZ7VyK7DtXWUoCew25I6xNRPg6sLeACAB1Bl9P5leUjulAMQlc6DYonybUcPSKpKHPvF6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=n/lSAdsl; arc=none smtp.client-ip=80.12.242.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="n/lSAdsl" Received: from fedora.home ([90.11.132.44]) by smtp.orange.fr with ESMTPA id ZB6MtxSpjzpxCZB6QtMswE; Sat, 18 Jan 2025 16:51:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1737215474; bh=FyWZR02z5B82iDwG7bL2VhnFmSHoovMQD3DXVbQ6qZ4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=n/lSAdslvDLa8YGCFWvMBFTWTPKhqk6i5rTQhjjXJ5/zzjfF+WJjFaohHmkEFNXi6 qNMuoSNm+V7ualri+WrbDJlps2iHiCNAnGx7an5EY6zvw/JBoxdB3HfgYIZ+CAK4SJ wVjp8xMJ/0kLXdfjYeLdrKTAZI/k8sKrvnGFCBU+3XgqtY8lPTYRwKeaWRr0olHaSo rUhto9Hzh7VuIrETyBPvMT99HkKm/jDEg7i8rF2iamOfXICTdymf/2hLxnbJNHP4WL iLq4eXd7PVlSyPlnWcJ7PCW6+/nsCTJOMdR+AbqDhGtATsaCSKfy37jGs7YyixZ1y8 OkSGhkXBuSgdg== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 18 Jan 2025 16:51:14 +0100 X-ME-IP: 90.11.132.44 From: Christophe JAILLET To: Basavaraj Natikar , Vinod Koul , Sanjay R Mehta Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dmaengine@vger.kernel.org Subject: [PATCH 1/3] dmaengine: ptdma: Fix an error handling parth in pt_pci_probe() Date: Sat, 18 Jan 2025 16:51:01 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If an error occurs after a successful pt_get_irqs() call, it should be undone by a corresponding pt_free_irqs(), as already done in the remove function. Fixes: fa5d823b16a9 ("dmaengine: ptdma: Initial driver for the AMD PTDMA") Signed-off-by: Christophe JAILLET --- Compile tested only --- drivers/dma/amd/ptdma/ptdma-pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma/amd/ptdma/ptdma-pci.c b/drivers/dma/amd/ptdma/ptdma-pci.c index 22739ff0c3c5..7f12474bd39f 100644 --- a/drivers/dma/amd/ptdma/ptdma-pci.c +++ b/drivers/dma/amd/ptdma/ptdma-pci.c @@ -182,7 +182,7 @@ static int pt_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) { dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", ret); - goto e_err; + goto e_free_irqs; } } @@ -192,10 +192,12 @@ static int pt_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret = pt_core_init(pt); if (ret) - goto e_err; + goto e_free_irqs; return 0; +e_free_irqs: + pt_free_irqs(pt); e_err: dev_err(dev, "initialization failed ret = %d\n", ret); From patchwork Sat Jan 18 15:51:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13944205 Received: from smtp.smtpout.orange.fr (smtp-69.smtpout.orange.fr [80.12.242.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F02FA127E18; Sat, 18 Jan 2025 15:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737215484; cv=none; b=i3ATkaH7Ph2xgPLawpVjtJP3yiK6O8sR1yaq2V858R6LPAJZNx2RMHApS4NdQkMG0lajljKUjz5TR5rMosa9C3Po7NCrgVQGbGrCcNxZPhY3UENAz4H5/xk+vd7cNfuNrfGTY3FuNgIylxusxJ9Bilf7LKu5tNbgYWxycngGGR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737215484; c=relaxed/simple; bh=kpDar05Z+8TDqXL0VdtmIGvXoPqyDSXE0TPyDExkCH4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qdd/LH9oRF+iXNBDl+FNi04tQAaa6mQgnp83c7XATYSiwNWVoZCCWYkB8RYGmrsx87vyPx+Ca/49RYkg2bPGHvYJ6jBACPStPQCSuerHaiEOiO5/+5qkHuKmlB82vg4s5992vZQ9TdGhrfI5jMvUtAoyWG7OQSzIESj6q1k6S1Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=UVtcia/F; arc=none smtp.client-ip=80.12.242.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="UVtcia/F" Received: from fedora.home ([90.11.132.44]) by smtp.orange.fr with ESMTPA id ZB6MtxSpjzpxCZB6WtMt45; Sat, 18 Jan 2025 16:51:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1737215480; bh=6OfKyfNh9kt18eqBJGlLtTA1zHGzp0LyAtBzM8XOuxE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UVtcia/FM6H859pGKKDOELvyte6Ap/JOEx647LRfK/4K5ebmEZj52dlwo7MSOutLN QupR5DXo0viX4/PCIJBamlxJx9uuhicfl9UeweUodQ+4YhAKQ/HWd9Bo+eG5IdGM7v KEmnz2jiqN8DveiCHdrSCI8QgvyRhfREpetr5m+GST0WJ7GHDS5rFrT+TXOok6aMnZ PsOR1boctIw+6pY3lRQvFayhi/fLuZlTMoY/yClOu/td4gfnU77EaohPEVP4yPdg0E rne6aokkwQWgjLTzT+ZXt0q5CBmpLEOfC4WFodEJ4N1TnBOW1LfslZs6Z68Ook9/3C C/MCMyfzVFRYQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 18 Jan 2025 16:51:20 +0100 X-ME-IP: 90.11.132.44 From: Christophe JAILLET To: Basavaraj Natikar , Vinod Koul Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dmaengine@vger.kernel.org Subject: [PATCH 2/3] dmaengine: ptdma: Slightly simplify error handling in pt_pci_probe() Date: Sat, 18 Jan 2025 16:51:02 +0100 Message-ID: <3285a03b9b3b6b6c8fa15f2bdc3a7d11386283af.1737215423.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 'ret' can be non-zero, only if pt_core_init() was called a few lines above. So move this test inside the same "if" to make things more obvious. Signed-off-by: Christophe JAILLET --- Compile tested only --- drivers/dma/amd/ptdma/ptdma-pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dma/amd/ptdma/ptdma-pci.c b/drivers/dma/amd/ptdma/ptdma-pci.c index 7f12474bd39f..b25b6f7618c3 100644 --- a/drivers/dma/amd/ptdma/ptdma-pci.c +++ b/drivers/dma/amd/ptdma/ptdma-pci.c @@ -188,11 +188,11 @@ static int pt_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev_set_drvdata(dev, pt); - if (pt->dev_vdata) + if (pt->dev_vdata) { ret = pt_core_init(pt); - - if (ret) - goto e_free_irqs; + if (ret) + goto e_free_irqs; + } return 0; From patchwork Sat Jan 18 15:51:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13944207 Received: from smtp.smtpout.orange.fr (smtp-69.smtpout.orange.fr [80.12.242.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF67718FDC2; Sat, 18 Jan 2025 15:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737215485; cv=none; b=unREKZa2cUOsa5rF7aI9r3lNxnMK5ovGSfAvJJC1B7nF3BS6Xl/vSiVVMbswIbWElXXGw6xQfh+ku6iOnQbRzoifvpJzHtLGbIw+wdJ3ZX68dl5jyXfGYluN04OBdRTgnherx51yYuPh3/h1xJWsWqXznxQ2wG6SSUpzfV3sJS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737215485; c=relaxed/simple; bh=R5a5YYjvbT3FLrTzU848q8G3+Avt1t/uTKvt8dKZ/Y4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OOe73bmqZtXsXh7ShQxGfpygnVOO5llQTDKlEl5Ps8o295Ss7SHGt5K3tLIB0limu0pezGe7o3Yr8vmTfoA2PciNGfQ9du+GqAIv4a0A1EEfD0ZTTQdHNVAoa5KBuhGNfcatnRBmPpObiEqfrImcC5DO1g4fMFeKfWtyQKNZCUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=Q8WTaNd9; arc=none smtp.client-ip=80.12.242.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="Q8WTaNd9" Received: from fedora.home ([90.11.132.44]) by smtp.orange.fr with ESMTPA id ZB6MtxSpjzpxCZB6XtMt6o; Sat, 18 Jan 2025 16:51:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1737215481; bh=Y2PuTFcztnweCTbiTYGMA0jecL5NxU2/H9dx67Jv4Sc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Q8WTaNd9dfLy5Y5HwRBdsBfVeFj3Jj+MUq3iWEgcPqNY6RD5l8mB8p77O2Bu/vjRt IKgxvVGm8k1m4f4wXfB+kUvjAKAo4XhkVSaeD5NjsJzzzTN1WAtrCg22OsfH+/uXaC 3sMfC+rNs15sXcAVmbKyod20YKxSbbvZlUvK04BV+8DyEaxp7a2/LNHe2I+5m8nCXm 2q5uuCIxRSH1Vigu/JJBTkn2Ni65yCYNiVdEcdaIPCltxOFlb4KfYgJEYcgHQMOGw5 U+QMTwu0znubSkjRjyFfIco65A9LSF1IgAmOwRlGfa5zcJkq1TQX5bqB5PUsB4lHk1 qDfkDKMmzXY2Q== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 18 Jan 2025 16:51:21 +0100 X-ME-IP: 90.11.132.44 From: Christophe JAILLET To: Basavaraj Natikar , Vinod Koul Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dmaengine@vger.kernel.org Subject: [PATCH 3/3] dmaengine: ptdma: Remove some dead code in pt_pci_remove() Date: Sat, 18 Jan 2025 16:51:03 +0100 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 'pt' can't be NULL when pt_pci_remove() is called. So remove a useless test and save a few lines of code. Signed-off-by: Christophe JAILLET --- Compile tested only --- drivers/dma/amd/ptdma/ptdma-pci.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/dma/amd/ptdma/ptdma-pci.c b/drivers/dma/amd/ptdma/ptdma-pci.c index b25b6f7618c3..25ad61265565 100644 --- a/drivers/dma/amd/ptdma/ptdma-pci.c +++ b/drivers/dma/amd/ptdma/ptdma-pci.c @@ -209,9 +209,6 @@ static void pt_pci_remove(struct pci_dev *pdev) struct device *dev = &pdev->dev; struct pt_device *pt = dev_get_drvdata(dev); - if (!pt) - return; - if (pt->dev_vdata) pt_core_destroy(pt);