Re: [PATCH] mISDN: Fix return values of the probe function

From: Jakub Kicinski
Date: Mon Oct 18 2021 - 19:15:38 EST


On Mon, 18 Oct 2021 20:06:51 +0300 Denis Kirjanov wrote:
> 10/18/21 5:20 PM, Zheyu Ma пишет:
> > During the process of driver probing, the probe function should return < 0
> > for failure, otherwise, the kernel will treat value > 0 as success.
>
> setup_card() checks for the return value.
> Thus it makes sense to submit the patch with net-next tag

setup_card() propagates the value returned by setup_hw() which in turn
gets propagated by hfc_probe() and hits local_pci_probe():

/*
* Probe function should return < 0 for failure, 0 for success
* Treat values > 0 as success, but warn.
*/
pci_warn(pci_dev, "Driver probe function unexpectedly returned %d\n",
rc);
return 0;

But you're right, this is a minor bug, hfc_remove_pci() checks if
driver data is already NULL so there will be no crash. Just a driver
bound to a device even though probe failed. Still net material tho.