]> Git Repo - J-u-boot.git/commitdiff
cmd/misc: Stop using a function pointer
authorTom Rini <[email protected]>
Wed, 22 Jun 2022 20:08:56 +0000 (16:08 -0400)
committerTom Rini <[email protected]>
Thu, 23 Jun 2022 01:29:47 +0000 (21:29 -0400)
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]>
cmd/misc.c

index bcd8d960ee06141447ccd2ed9291dabf2cb64f08..ec32b41ed1e96f01bcc27b1d3d2a6226d8966bed 100644 (file)
@@ -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",
This page took 0.036204 seconds and 4 git commands to generate.