Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Sep 2010 08:34:20 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/kern bus_if.m
Message-ID:  <201009130834.o8D8YcjT023282@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
avg         2010-09-13 08:34:20 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             bus_if.m 
  Log:
  SVN rev 212544 on 2010-09-13 08:34:20Z by avg
  
  bus_add_child: add specialized default implementation that calls panic
  
  If a kobj method doesn't have any explicitly provided default
  implementation, then it is auto-assigned kobj_error_method.
  kobj_error_method is proper only for methods that return error code,
  because it just returns ENXIO.
  So, in the case of unimplemented bus_add_child caller would get
  (device_t)ENXIO as a return value, which would cause the mistake to go
  unnoticed, because return value is typically checked for NULL.
  Thus, a specialized null_add_child is added.  It would have sufficied
  for correctness to return NULL, but this type of mistake was deemed to
  be rare and serious enough to call panic instead.
  
  Watch out for this kind of problem with other kobj methods.
  
  Suggested by:   jhb, imp
  MFC after:      2 weeks
  
  Revision  Changes    Path
  1.41      +11 -1     src/sys/kern/bus_if.m



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009130834.o8D8YcjT023282>