* [PATCH] w1: matrox: Remove some deadcode in matrox_w1_remove()
@ 2025-08-21 10:02 Christophe JAILLET
2025-08-24 16:56 ` Krzysztof Kozlowski
2025-08-31 12:14 ` Krzysztof Kozlowski
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2025-08-21 10:02 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET
The .remove function can only be called if the .probe() succeeds. So there
is no need to keep track of a successful probe in 'found'.
Simplify code accordingly.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
drivers/w1/masters/matrox_w1.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c
index 2852cd2dc67c..146fa7c6e74e 100644
--- a/drivers/w1/masters/matrox_w1.c
+++ b/drivers/w1/masters/matrox_w1.c
@@ -47,7 +47,6 @@ struct matrox_device {
unsigned long phys_addr;
void __iomem *virt_addr;
- unsigned long found;
struct w1_bus_master *bus_master;
};
@@ -158,8 +157,6 @@ static int matrox_w1_probe(struct pci_dev *pdev, const struct pci_device_id *ent
pci_set_drvdata(pdev, dev);
- dev->found = 1;
-
dev_info(&pdev->dev, "Matrox G400 GPIO transport layer for 1-wire.\n");
return 0;
@@ -176,10 +173,9 @@ static void matrox_w1_remove(struct pci_dev *pdev)
{
struct matrox_device *dev = pci_get_drvdata(pdev);
- if (dev->found) {
- w1_remove_master_device(dev->bus_master);
- iounmap(dev->virt_addr);
- }
+ w1_remove_master_device(dev->bus_master);
+ iounmap(dev->virt_addr);
+
kfree(dev);
}
--
2.50.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] w1: matrox: Remove some deadcode in matrox_w1_remove()
2025-08-21 10:02 [PATCH] w1: matrox: Remove some deadcode in matrox_w1_remove() Christophe JAILLET
@ 2025-08-24 16:56 ` Krzysztof Kozlowski
2025-08-31 12:14 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-24 16:56 UTC (permalink / raw)
To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors
On 21/08/2025 12:02, Christophe JAILLET wrote:
> The .remove function can only be called if the .probe() succeeds. So there
> is no need to keep track of a successful probe in 'found'.
>
> Simplify code accordingly.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
> drivers/w1/masters/matrox_w1.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c
> index 2852cd2dc67c..146fa7c6e74e 100644
> --- a/drivers/w1/masters/matrox_w1.c
> +++ b/drivers/w1/masters/matrox_w1.c
> @@ -47,7 +47,6 @@ struct matrox_device {
>
> unsigned long phys_addr;
> void __iomem *virt_addr;
> - unsigned long found;
>
> struct w1_bus_master *bus_master;
> };
> @@ -158,8 +157,6 @@ static int matrox_w1_probe(struct pci_dev *pdev, const struct pci_device_id *ent
>
> pci_set_drvdata(pdev, dev);
>
> - dev->found = 1;
What wonderful code was this... Good catch, I'll apply it soon.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] w1: matrox: Remove some deadcode in matrox_w1_remove()
2025-08-21 10:02 [PATCH] w1: matrox: Remove some deadcode in matrox_w1_remove() Christophe JAILLET
2025-08-24 16:56 ` Krzysztof Kozlowski
@ 2025-08-31 12:14 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-31 12:14 UTC (permalink / raw)
To: Krzysztof Kozlowski, Christophe JAILLET; +Cc: linux-kernel, kernel-janitors
On Thu, 21 Aug 2025 12:02:21 +0200, Christophe JAILLET wrote:
> The .remove function can only be called if the .probe() succeeds. So there
> is no need to keep track of a successful probe in 'found'.
>
> Simplify code accordingly.
>
>
Applied, thanks!
[1/1] w1: matrox: Remove some deadcode in matrox_w1_remove()
https://git.kernel.org/krzk/linux-w1/c/25fb0ea986dc10e05f3f4b43cabde4d1853a1fd7
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-31 12:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-21 10:02 [PATCH] w1: matrox: Remove some deadcode in matrox_w1_remove() Christophe JAILLET
2025-08-24 16:56 ` Krzysztof Kozlowski
2025-08-31 12:14 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).