<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hello Christian,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 19, 2021 at 10:18 PM Christian Mauderer <<a href="mailto:oss@c-mauderer.de" target="_blank">oss@c-mauderer.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello Niteesh,<br>
<br>
On 19/04/2021 18:45, Niteesh G. S. wrote:<br>
> <br>
> <br>
> On Mon, Apr 19, 2021 at 9:55 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a> <br>
> <mailto:<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>>> wrote:<br>
> <br>
>     On Sun, Apr 18, 2021 at 9:12 AM G S Niteesh Babu<br>
>     <<a href="mailto:niteesh.gs@gmail.com" target="_blank">niteesh.gs@gmail.com</a> <mailto:<a href="mailto:niteesh.gs@gmail.com" target="_blank">niteesh.gs@gmail.com</a>>> wrote:<br>
>      ><br>
>      > Adds "rtems,path" as an additional bus path for the i2c driver.<br>
>      > Previously the bus path was provided in "rtems,i2c-path" property<br>
>      > only.<br>
>      > ---<br>
>      >  rtemsbsd/sys/dev/iicbus/rtems-i2c.c | 9 ++++++---<br>
>      >  1 file changed, 6 insertions(+), 3 deletions(-)<br>
>      ><br>
>      > diff --git a/rtemsbsd/sys/dev/iicbus/rtems-i2c.c<br>
>     b/rtemsbsd/sys/dev/iicbus/rtems-i2c.c<br>
>      > index b965f248..7ac7a7c4 100644<br>
>      > --- a/rtemsbsd/sys/dev/iicbus/rtems-i2c.c<br>
>      > +++ b/rtemsbsd/sys/dev/iicbus/rtems-i2c.c<br>
>      > @@ -87,9 +87,12 @@ rtems_i2c_attach(device_t dev)<br>
>      ><br>
>      >         len = OF_getprop_alloc(node, "rtems,i2c-path", &sc->path);<br>
>      >         if (len == -1){<br>
>      > -               device_printf(sc->dev, "Path not found in Device<br>
>     Tree");<br>
>      > -               OF_prop_free(sc->path);<br>
>      > -               return (ENXIO);<br>
>      > +               len = OF_getprop_alloc(node, "rtems,path",<br>
>     &sc->path);<br>
>      > +               if (len == -1) {<br>
>      > +                       device_printf(sc->dev, "Path not found in<br>
>     Device Tree");<br>
>      > +                       OF_prop_free(sc->path);<br>
>     If OF_get_prop_alloc failed, is sc->path valid here? Or do you<br>
>     free(NULL) maybe.<br>
> <br>
> OF_getprop_alloc doesn't allocate a buffer on missing properties and 0 <br>
> length<br>
> properties. In other cases, if it internally fails(in OF_getprop) it <br>
> frees the buffer and<br>
> then returns.<br>
> In this case, if no path property exists we just free a null buffer.<br>
> <br>
<br>
So if I understand you correctly, we either get a valid pointer with len <br>
!= -1 or we get NULL? Sounds like the OF_prop_free(...) wasn't necessary <br>
before your change and isn't necessary now. So you might remove it.<br></blockquote><div><div class="gmail_default" style="font-size:small">I have removed it and have sent a v2.</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The updated list of patches pending.</div><div class="gmail_default">1) <a href="https://lists.rtems.org/pipermail/devel/2021-April/066458.html" target="_blank">https://lists.rtems.org/pipermail/devel/2021-April/066458.html</a></div><div class="gmail_default">2) <a href="https://lists.rtems.org/pipermail/devel/2021-April/066460.html" target="_blank">https://lists.rtems.org/pipermail/devel/2021-April/066460.html</a></div><div class="gmail_default" style="font-size:small"><a href="https://lists.rtems.org/pipermail/devel/2021-April/066660.html">3) https://lists.rtems.org/pipermail/devel/2021-April/066660.html</a></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks,</div><div class="gmail_default" style="font-size:small">Niteesh.</div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Best regards<br>
<br>
Christian<br>
<br>
> <br>
>      > +                       return (ENXIO);<br>
>      > +               }<br>
>      >         }<br>
>      ><br>
>      >         if ((sc->sc_iicbus = device_add_child(sc->dev, "iicbus",<br>
>     -1)) == NULL) {<br>
>      > --<br>
>      > 2.17.1<br>
>      ><br>
>      > _______________________________________________<br>
>      > devel mailing list<br>
>      > <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a>><br>
>      > <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
>     <<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a>><br>
> <br>
> <br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
> <br>
</blockquote></div></div>