The following reply was made to PR kern/48243; it has been noted by GNATS.
If a pointer can be NULL and not NULL then it always make sence to check th=
is (at least in debug-builds) to catch
any situation where the expected state is not the expected one.
And if a call to a subroutine 'can (should?)' never fail, this should to be=
checked to=F6.
If you think the code is stable enought that it will never fail, you may ad=
d checks only for debug-builds to validate this.
This wouldn't harm performance in normal kernels.
This is my understanding from a 'stable' source that allows searching for e=
rrors if any happen.
And perhaps it would be a good idea to add a short comment when the pointer=
is NULL or not ..
As stated in the initial report, I found this by analysing a problem I've w=
ith something in the USB stack.
It is along time ago and I don't remember the cause why I've a look at it a=
nymore - sorry.
As far as I remember, it was never the cause of a kernel crash - in that ca=
se I haven't classified the report as non-critical/medium.
On Mon, 3 Oct 2016 06:50:49 +0000
<sk...@NetBSD.org> wrote:
> Synopsis: inconsistant usage of 'up->parent' in usb_subr.c
>=20
> State-Changed-From-To: open->feedback
> State-Changed-By: sk...@NetBSD.org
> State-Changed-When: Mon, 03 Oct 2016 06:50:49 +0000
> State-Changed-Why:
> The only time up->up_parent is non-NULL is for a root hub. Here the
> usbd_get_initial_ddsec can (should?) never fail and therefore the
> usbd_reset_port won't happen.
>=20
> Is the code as-is really a problem?
>=20
>=20
>=20
--=20