Re: [net PATCH v2] octeontx2-af: Move validation of ptp pointer before its usage

From: Dan Carpenter
Date: Fri Jun 23 2023 - 07:44:16 EST


On Fri, Jun 23, 2023 at 11:28:19AM +0000, Sai Krishna Gajula wrote:
> > This probe function is super weird how it returns success on the failure path.
> > One concern, I had initially was that if anything returns -EPROBE_DEFER then
> > we cannot recover. That's not possible in the current code, but it makes me
> > itch... But here is a different crash.
> >
>
> In few circumstances, the PTP device is probed before the AF device in
> the driver. In such instance, -EPROBE_DEFER is used.
> -- EDEFER_PROBE is useful when probe order changes. Ex: AF driver probes before PTP.
>

You're describing how -EPROBE_DEFER is *supposed* to work. But that's
not what this driver does.

If the AF driver is probed before the PTP driver then ptp_probe() should
return -EPROBE_DEFER and that would allow the kernel to automatically
retry ptp_probe() later. But instead of that, ptp_probe() returns
success. So I guess the user would have to manually rmmod it and insmod
it again? So, what I'm saying I don't understand why we can't do this
in the normal way.

The other thing I'm saying is that the weird return success on error
stuff hasn't been tested or we would have discovered the crash through
testing.

regards,
dan carpenter