diff options
| author | Tom Rini <[email protected]> | 2022-06-22 16:08:56 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2022-06-22 21:29:47 -0400 |
| commit | c4645fc87e96e730a6c140d7d7820be2da1b2743 (patch) | |
| tree | 2b38b510c055b2053dae6eedb57796c31fcae3d0 /cmd/misc.c | |
| parent | f98457d70a35ad6bda284577a8a2a8ad7868b13b (diff) | |
cmd/misc: Stop using a function pointer
Currently, enabling CMD_MISC gives:
cmd/misc.c:67:25: warning: assignment to 'int (*)(struct udevice *, int, void *, int)' from incompatible pointer type 'int (*)(struct udevice *, int, const void *, int)' [-Wincompatible-pointer-types]
Because 'misc_read' takes a void * and 'misc_write' takes a const void
*, both of which make sense for their operation. Given there's one
place we make use of the function pointer, just call read or write
directly for the operation we're called with.
Reviewed-by: Bin Meng <[email protected]>
Reviewed-by: Sean Anderson <[email protected]>
Signed-off-by: Tom Rini <[email protected]>
Diffstat (limited to 'cmd/misc.c')
| -rw-r--r-- | cmd/misc.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/cmd/misc.c b/cmd/misc.c index bcd8d960ee0..ec32b41ed1e 100644 --- a/cmd/misc.c +++ b/cmd/misc.c @@ -44,7 +44,6 @@ static int do_misc_list(struct cmd_tbl *cmdtp, int flag, static int do_misc_op(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], enum misc_op op) { - int (*misc_op)(struct udevice *, int, void *, int); struct udevice *dev; int offset; void *buf; @@ -62,11 +61,10 @@ static int do_misc_op(struct cmd_tbl *cmdtp, int flag, size = hextoul(argv[3], NULL); if (op == MISC_OP_READ) - misc_op = misc_read; + ret = misc_read(dev, offset, buf, size); else - misc_op = misc_write; + ret = misc_write(dev, offset, buf, size); - ret = misc_op(dev, offset, buf, size); if (ret < 0) { if (ret == -ENOSYS) { printf("The device does not support %s\n", |
