<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 18, 2021 at 11:52 AM 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 Thu, Feb 18, 2021 at 10:20 AM Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>> wrote:<br>
><br>
><br>
><br>
> On Thu, Feb 18, 2021 at 11:06 AM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> wrote:<br>
>><br>
>> On Thu, Feb 18, 2021 at 8:56 AM Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>> wrote:<br>
>> ><br>
>> > Hi<br>
>> ><br>
>> > There are a lot of Coverity issues related to device drivers which call mkdir("/dev") and ignore the return value. My first thought was that they should have (void) added since /dev could have been created by an earlier driver.<br>
>> ><br>
>> > Then it occurred to me that libcsupport/src/base_fs.c includes mkdir("/dev") and a fatal error if it cannot create it.<br>
>> ><br>
>> > Doesn't this mean that every call to mkdir("/dev") in a BSP or device driver is redundant? They should be removed since the base FS contents are always in place before any device drivers are called.<br>
>> ><br>
>> > Thoughts?<br>
>> ><br>
>><br>
>> Seems reasonable. You could probably add an assert that /dev exists.<br>
><br>
><br>
> The creation of the device node will fail if /dev does not exist so I think that<br>
> is covered.<br>
><br>
> I think the call is pointless and changing it to stat() to make sure it exists<br>
> just adds bulk to the driver/BSP dependencies.<br>
><br>
> I think just deleting it seems prudent. There is an error path if it doesn't<br>
> exist.<br>
><br>
<br>
ok. I was just suggesting conversion to an assert since that is some<br>
good practice when you have a belief/assumption but aren't totally<br>
convinced. It's fine with me either way. assert(mkdir("/dev") == -1)<br>
or just delete it.<br></blockquote><div><br></div><div>Grrr.. I've looked again at the code and it is all Gaisler code doing something</div><div>like mkdir("/dev/leonXXX"). It really could fail. This should be a fatal error</div><div>and would seem to indicate that we need a grlib category of fatal BSP/driver</div><div>errors.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> --joel<br>
>><br>
>><br>
>> > --joel<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>