* [PATCH] misc: rp1: Omit two variable reassignments in rp1_probe()
@ 2025-10-20 13:00 Markus Elfring
2025-10-21 10:13 ` Andrea della Porta
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2025-10-20 13:00 UTC (permalink / raw)
To: Andrea della Porta, Arnd Bergmann, Bjorn Helgaas,
Florian Fainelli, Greg Kroah-Hartman
Cc: kernel-janitors, LKML, Anand Moon, Christophe Jaillet
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 20 Oct 2025 14:51:43 +0200
Subject: [PATCH] misc: rp1: Omit two variable reassignments in rp1_probe()
An error code was assigned to a variable and checked accordingly.
This value was passed to a dev_err_probe() call in an if branch.
This function is documented in the way that the same value is returned.
Thus delete two redundant variable reassignments.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/misc/rp1/rp1_pci.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/rp1/rp1_pci.c b/drivers/misc/rp1/rp1_pci.c
index 803832006ec8..3baea1a24549 100644
--- a/drivers/misc/rp1/rp1_pci.c
+++ b/drivers/misc/rp1/rp1_pci.c
@@ -226,8 +226,7 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err = pcim_enable_device(pdev);
if (err < 0) {
- err = dev_err_probe(&pdev->dev, err,
- "Enabling PCI device has failed");
+ dev_err_probe(&pdev->dev, err, "Enabling PCI device has failed");
goto err_put_node;
}
@@ -243,8 +242,7 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err = pci_alloc_irq_vectors(pdev, RP1_INT_END, RP1_INT_END,
PCI_IRQ_MSIX);
if (err < 0) {
- err = dev_err_probe(&pdev->dev, err,
- "Failed to allocate MSI-X vectors\n");
+ dev_err_probe(&pdev->dev, err, "Failed to allocate MSI-X vectors\n");
goto err_put_node;
} else if (err != RP1_INT_END) {
dev_err(&pdev->dev, "Cannot allocate enough interrupts\n");
--
2.51.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] misc: rp1: Omit two variable reassignments in rp1_probe()
2025-10-20 13:00 [PATCH] misc: rp1: Omit two variable reassignments in rp1_probe() Markus Elfring
@ 2025-10-21 10:13 ` Andrea della Porta
0 siblings, 0 replies; 2+ messages in thread
From: Andrea della Porta @ 2025-10-21 10:13 UTC (permalink / raw)
To: Markus Elfring
Cc: Andrea della Porta, Arnd Bergmann, Bjorn Helgaas,
Florian Fainelli, Greg Kroah-Hartman, kernel-janitors, LKML,
Anand Moon, Christophe Jaillet
Hi Markus,
thanks for your patch!
On 15:00 Mon 20 Oct , Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 20 Oct 2025 14:51:43 +0200
> Subject: [PATCH] misc: rp1: Omit two variable reassignments in rp1_probe()
>
> An error code was assigned to a variable and checked accordingly.
> This value was passed to a dev_err_probe() call in an if branch.
> This function is documented in the way that the same value is returned.
> Thus delete two redundant variable reassignments.
>
> The source code was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Andrea della Porta <andrea.porta@suse.com>
> ---
> drivers/misc/rp1/rp1_pci.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/misc/rp1/rp1_pci.c b/drivers/misc/rp1/rp1_pci.c
> index 803832006ec8..3baea1a24549 100644
> --- a/drivers/misc/rp1/rp1_pci.c
> +++ b/drivers/misc/rp1/rp1_pci.c
> @@ -226,8 +226,7 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>
> err = pcim_enable_device(pdev);
> if (err < 0) {
> - err = dev_err_probe(&pdev->dev, err,
> - "Enabling PCI device has failed");
> + dev_err_probe(&pdev->dev, err, "Enabling PCI device has failed");
> goto err_put_node;
> }
>
> @@ -243,8 +242,7 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> err = pci_alloc_irq_vectors(pdev, RP1_INT_END, RP1_INT_END,
> PCI_IRQ_MSIX);
> if (err < 0) {
> - err = dev_err_probe(&pdev->dev, err,
> - "Failed to allocate MSI-X vectors\n");
> + dev_err_probe(&pdev->dev, err, "Failed to allocate MSI-X vectors\n");
> goto err_put_node;
> } else if (err != RP1_INT_END) {
> dev_err(&pdev->dev, "Cannot allocate enough interrupts\n");
> --
> 2.51.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-21 10:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 13:00 [PATCH] misc: rp1: Omit two variable reassignments in rp1_probe() Markus Elfring
2025-10-21 10:13 ` Andrea della Porta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox