<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 19, 2021 at 9:55 PM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</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">On Sun, Apr 18, 2021 at 9:12 AM G S Niteesh Babu <<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 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 Tree");<br>
> -               OF_prop_free(sc->path);<br>
> -               return (ENXIO);<br>
> +               len = OF_getprop_alloc(node, "rtems,path", &sc->path);<br>
> +               if (len == -1) {<br>
> +                       device_printf(sc->dev, "Path not found in Device Tree");<br>
> +                       OF_prop_free(sc->path);<br>
If OF_get_prop_alloc failed, is sc->path valid here? Or do you free(NULL) maybe.<br></blockquote><div><div class="gmail_default" style="font-size:small">OF_getprop_alloc doesn't allocate a buffer on missing properties and 0 length</div><div class="gmail_default" style="font-size:small">properties. In other cases, if it internally fails(in OF_getprop) it frees the buffer and</div><div class="gmail_default" style="font-size:small">then returns.</div><div class="gmail_default" style="font-size:small">In this case, if no path property exists we just free a null buffer.</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> +                       return (ENXIO);<br>
> +               }<br>
>         }<br>
><br>
>         if ((sc->sc_iicbus = device_add_child(sc->dev, "iicbus", -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><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>