Skip to content

Commit

Permalink
utils: Fix invalid parameters passed to fprintf
Browse files Browse the repository at this point in the history
The previous commit(s) reworking IIO attributes changed the type of the
'attr' variable from a const string to a 'struct iio_attr *'.

It appears that the code was not properly updated at two different
spots; update it so that it works properly.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Nov 8, 2023
1 parent 6c19715 commit a9449ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/gen_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,11 @@ void gen_function(const char* prefix, const char* target,
if (wbuf) {
fprintf(fd, " # Write string to %s attribute:\n", prefix);
if (!strcmp(prefix, "device") || !strcmp(prefix, "channel")) {
fprintf(fd, " %s.attrs[\"%s\"].value = str(\"%s\")\n", target, attr, wbuf);
fprintf(fd, " %s.attrs[\"%s\"].value = str(\"%s\")\n", target,
iio_attr_get_name(attr), wbuf);
} else if (!strcmp(prefix, "device_debug")) {
fprintf(fd, " %s.debug_attrs[\"%s\"].value = str(\"%s\")\n", target, attr, wbuf);
fprintf(fd, " %s.debug_attrs[\"%s\"].value = str(\"%s\")\n", target,
iio_attr_get_name(attr), wbuf);
} else {
fprintf(fd, " # Write for %s / %s not implemented yet\n", prefix, target);
}
Expand Down

0 comments on commit a9449ec

Please sign in to comment.