Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] seemingly wrong up_putc usage in lcd drivers #14694

Closed
1 task done
yamt opened this issue Nov 8, 2024 · 2 comments · Fixed by #14736
Closed
1 task done

[BUG] seemingly wrong up_putc usage in lcd drivers #14694

yamt opened this issue Nov 8, 2024 · 2 comments · Fixed by #14736
Labels
Arch: all Issues that apply to all architectures Area: Drivers Drivers issues OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working

Comments

@yamt
Copy link
Contributor

yamt commented Nov 8, 2024

Description / Steps to reproduce the issue

many lcd drivers have a code fragment like the following:

#if 0 /* Sometimes useful */
static void stm3240g_dumprun(const char *msg,
uint16_t *run, size_t npixels)
{
int i;
int j;
syslog(LOG_DEBUG, "\n%s:\n", msg);
for (i = 0; i < npixels; i += 16)
{
up_putc(' ');
syslog(LOG_DEBUG, " ");
for (j = 0; j < 16; j++)
{
syslog(LOG_DEBUG, " %04x", *run++);
}
up_putc('\n');
}
}
#endif

(i'm not sure why it's common for lcd drivers. maybe just a result of heavy copy-and-paste?)

it seems like mixing syslog and up_putc, assuming they output to the same console.
of course, the assumption might or might not be correct, depending on the system and configurations.

this isn't a major problem as these code fragments are often wrapped with #if 0 though.

On which OS does this issue occur?

[OS: Mac]

What is the version of your OS?

macOS 14.7

NuttX Version

master

Issue Architecture

[Arch: all]

Issue Area

[Area: Drivers]

Verification

  • I have verified before submitting the report.
@yamt yamt added the Type: Bug Something isn't working label Nov 8, 2024
@github-actions github-actions bot added Arch: all Issues that apply to all architectures Area: Drivers Drivers issues OS: Mac Issues related to MacOS (building system, etc) labels Nov 8, 2024
@acassis
Copy link
Contributor

acassis commented Nov 8, 2024

@yamt good catch, according to git blame these lines were added by @patacongo in 2012 and 2014 respectively, so I think it is not my mistake, should have some reason.

@patacongo
Copy link
Contributor

@yamt good catch, according to git blame these lines were added by @patacongo in 2012 and 2014 respectively, so I think it is not my mistake, should have some reason.

Its just old debug code that was left in. The xyz_dumprun() functions are not referenced from anywhere in the OS and just be removed.

yamt added a commit to yamt/incubator-nuttx that referenced this issue Nov 12, 2024
* It seems that they assume up_putc() and syslog() outputs to the
  same device. Depending on the system and configurations, it's wrong.

* They are wrapped with "#if 0" and unused.

Fixes apache#14694
yamt added a commit to yamt/incubator-nuttx that referenced this issue Nov 12, 2024
* It seems that they assume up_putc() and syslog() outputs to the
  same device. Depending on the system and configurations, it's wrong.

* They are wrapped with "#if 0" and unused.

Fixes apache#14694
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: all Issues that apply to all architectures Area: Drivers Drivers issues OS: Mac Issues related to MacOS (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants