Re: [PATCH v2] block: mtip32xx: Prioritize state cleanup over memory freeing in the mtip_pci_probe error path.

From: Andy Shevchenko
Date: Mon Aug 25 2025 - 09:40:57 EST


On Mon, Aug 25, 2025 at 01:33:17PM +0200, Philipp Stanner wrote:
> On Sat, 2025-08-23 at 16:32 +0800, Zhang Heng wrote:

...

> So I think that the pci_set_drvdata(… NULL) can be removed
> alltogether. 
>
> When working on the probe() / remove() paths last and this year, I came
> to believe that calls like that were often used because of a
> misunderstanding of how the driver core APIs work.

I think there are other aspects that makes this happen (any combination of them
possible):

1) old books for Linux kernel development with outdated examples (these calls
used to be required ca. 2010);

2) initial driver development based on (quite) old examples;

3) (as you said) misunderstanding of the device enumeration process in Linux
device model;

4) ...anything else I forgot...

--
With Best Regards,
Andy Shevchenko