]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Tentatively apply D23730:
authordim <dim@FreeBSD.org>
Mon, 17 Feb 2020 18:31:32 +0000 (18:31 +0000)
committerdim <dim@FreeBSD.org>
Mon, 17 Feb 2020 18:31:32 +0000 (18:31 +0000)
commitbec21a55cda0458cae94f1cdd509c613b87898e1
treebb3b02e8552db899b4b1030e13e27cbf2489cbf3
parent875d2945f01b3696460baaba69bd1d036f6f5185
Tentatively apply D23730:

Fix compile errors in altera_sdcard_io.c after r357647

Summary:
After rS357647, building universe results in compilation errors for
_.mips.BERI_DE4_SDROOT:

```
sys/dev/altera/sdcard/altera_sdcard_io.c: In function 'altera_sdcard_io_start_internal':
sys/dev/altera/sdcard/altera_sdcard_io.c:299:13: error: '*bp' is a pointer; did you mean to use '->'?
  switch (*bp->bio_cmd) {
             ^~
             ->
sys/dev/altera/sdcard/altera_sdcard_io.c:301:38: error: '*bp' is a pointer; did you mean to use '->'?
   altera_sdcard_write_cmd_arg(sc, *bp->bio_pblkno *
                                      ^~
                                      ->
sys/dev/altera/sdcard/altera_sdcard_io.c:307:42: error: '*bp' is a pointer; did you mean to use '->'?
   altera_sdcard_write_rxtx_buffer(sc, *bp->bio_data,
                                          ^~
                                          ->
sys/dev/altera/sdcard/altera_sdcard_io.c:308:10: error: '*bp' is a pointer; did you mean to use '->'?
       *bp->bio_bcount);
          ^~
          ->
sys/dev/altera/sdcard/altera_sdcard_io.c:309:38: error: '*bp' is a pointer; did you mean to use '->'?
   altera_sdcard_write_cmd_arg(sc, *bp->bio_pblkno *
                                      ^~
                                      ->
sys/dev/altera/sdcard/altera_sdcard_io.c: In function 'altera_sdcard_io_start':
sys/dev/altera/sdcard/altera_sdcard_io.c:336:20: error: incompatible types when assigning to type 'struct bio *' from type 'struct bio'
  sc->as_currentbio = *bp;
                    ^
```

The first few are because `->` has a higher precedence than `*`, so the
expressions should use `(*bp)->foo` instead.  I also renamed the
variable to `bpp` to make it clearer that it is a pointer-to-pointer.

The last one is because `sc->as_currentbio` is already a `struct bio *`,
there is no need to dereference `bp` there.

Last but not least, I would really suggest rewriting the
`altera_sdcard_io_start_internal()` function to just return success or
failure, so the caller can decide to set `bp` to NULL.
sys/dev/altera/sdcard/altera_sdcard_io.c