On Wed, Feb 09, 2022 at 12:17:17PM +0000, Julien Grall wrote:
> > > > +static HYPFS_DIR_INIT_FUNC(host_dt_dir, HOST_DT_DIR, 
> > > > &host_dt_dir_funcs);
> > > > +
> > > > +static int __init host_dtb_export_init(void)
> > > > +{
> > > > +    ASSERT(dt_host && (dt_host->sibling == NULL));
> > > 
> > > dt_host can be NULL when booting on ACPI platform. So I think this wants 
> > > to
> > > be turned to a normal check and return directly.
> > > 
> > 
> > I will replace if with
> > if ( !acpi_disabled )
> >      return -ENODEV;
> > 
> > > Also could you explain why you need to check dt_host->sibling?
> > > 
> > 
> > This is my way to check if dt_host points to the top of the device-tree.
> > In any case I will replace it with !acpi_disabled as I mentioned
> > earlier.
> 
> dt_host will always points to the root of the host device-tree. I don't
> think it is the job of hypfs to enforce it unless you expect the code to be
> buggy if this happens. But then I would argue the code should be hardened.
> 

Hi Julien,

Unfortunatelly I can't use acpi_disabled in host_dtb_export_init because
I've already moved host_dtb_export.c to the common folder.

As for the host->sibling - I took the whole assert:
ASSERT(dt_host && (dt_host->sibling == NULL));
from the prepare_dtb_hwdom function. And this assertion was added by the
commit b8f1c5e7039efbe1103ed3fe4caedf8c34affe13 authored by you.

What do you think if I omit dt_host->sibling check and make it:

if ( !dt_host )
    return -ENODEV;

Best regards,
Olkesii.

Reply via email to