[PATCH] bsps/shared/grlib/1553/b1553brm.c : addressed logic issue and unsigned_compare

Joel Sherrill joel at rtems.org
Sun Mar 1 18:32:39 UTC 2020


On Sun, Mar 1, 2020, 12:03 AM suyash singh <suyashsingh234 at gmail.com> wrote:

> I don't know. There are checks for other things in the function when it
> return other than successful.
>

I don't know this code but count starts at 0. If nothing is processed, I
would expect the count to be 0 after the loop.

I would tend to change the <= to ==. If no data was processed, that's the
condition. The code is just slightly off.

>
> Since it was never going to return "RTEMS_UNSATISFIED" as the "if" would
> always evaluate to true I removed the unnecessary comparison
>
> On Sat, Feb 29, 2020 at 2:52 AM Peter Dufault <dufault at hda.com> wrote:
>
>> And regardless of the value of count it is successful?
>>
>> > On Feb 28, 2020, at 12:17 , suyash singh <suyashsingh234 at gmail.com>
>> wrote:
>> >
>> > count is unsigned int and will always be >=0.
>> >
>> > On Fri, Feb 28, 2020 at 10:42 PM suyash singh <suyashsingh234 at gmail.com>
>> wrote:
>> > ---
>> >  bsps/shared/grlib/1553/b1553brm.c | 6 ++----
>> >  1 file changed, 2 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/bsps/shared/grlib/1553/b1553brm.c
>> b/bsps/shared/grlib/1553/b1553brm.c
>> > index 57ef70126b..4041423541 100644
>> > --- a/bsps/shared/grlib/1553/b1553brm.c
>> > +++ b/bsps/shared/grlib/1553/b1553brm.c
>> > @@ -982,10 +982,8 @@ static rtems_device_driver
>> brm_write(rtems_device_major_number major, rtems_devi
>> >
>> >         rw_args->bytes_moved = count;
>> >
>> > -       if (count >= 0) {
>> > -               return RTEMS_SUCCESSFUL;
>> > -       }
>> > -       return RTEMS_UNSATISFIED;
>> > +       return RTEMS_SUCCESSFUL;
>> > +
>> >  }
>> >
>> >  static rtems_device_driver brm_control(rtems_device_major_number
>> major, rtems_device_minor_number minor, void *arg)
>> > --
>> > 2.17.1
>> >
>> > _______________________________________________
>> > devel mailing list
>> > devel at rtems.org
>> > http://lists.rtems.org/mailman/listinfo/devel
>>
>> Peter
>> -----------------
>> Peter Dufault
>> HD Associates, Inc.      Software and System Engineering
>>
>> This email is delivered through the public internet using protocols
>> subject to interception and tampering.
>>
>> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200301/8d70725a/attachment.html>


More information about the devel mailing list