Skip to content

[BUG][Cppcheck][EDMA] unused variables #3843

Closed

Description

@cujomalainey

In imx edma driver there are some variables that are set but never used, this is upsetting cppcheck but they are explicitly labeled in comments. Paul you appear to have added some of these, do you want to suppress these errors or remove these variables?

Activity

  1. changed the title [-][BUG][Cppcheck] [/-] [+][BUG][Cppcheck] [EDMA] unused variables[/+] on Feb 11, 2021
  2. changed the title [-][BUG][Cppcheck] [EDMA] unused variables[/-] [+][BUG][Cppcheck][EDMA] unused variables[/+] on Feb 11, 2021
  3. dbaluta commented on Feb 12, 2021

    @dbaluta
    Collaborator

    @cujomalainey care to share with us the command line you use to run cppcheck. Just running cppcheck with no arguments results in no error.

  4. dbaluta commented on Feb 12, 2021

    @dbaluta
    Collaborator

    Later edit:

    $ cppcheck --enable=all --inconclusive --library=posix drivers/imx/edma.c 
    Checking drivers/imx/edma.c ...
    drivers/imx/edma.c:368:13: style: Variable 'handshake' is assigned a value that is never used. [unreadVariable]
      handshake = config->dest_dev;
                ^
    drivers/imx/edma.c:373:13: style: Variable 'handshake' is assigned a value that is never used. [unreadVariable]
      handshake = config->src_dev;
                ^
    drivers/imx/edma.c:349:17: style: Variable 'irq' is not assigned a value. [unassignedVariable]
     int handshake, irq;
                    ^
    nofile:0:0: information: Cppcheck cannot find all the include files (use --check-config for details) [missingIncludeSystem]
    ``
    
  5. cujomalainey commented on Feb 12, 2021

    @cujomalainey
    ContributorAuthor

    Looks like you found them

  6. cujomalainey commented on Feb 12, 2021

    @cujomalainey
    ContributorAuthor

    also, ignore divide by sizeof(pointer), those are a bug in cppcheck that I have started a topic upstream about. https://sourceforge.net/p/cppcheck/discussion/general/thread/d7881b159c/

  7. paulstelian97 commented on Feb 15, 2021

    @paulstelian97
    Collaborator

    A refactor changed the way the DAI drivers fetch the handshake and I forgot to update edma. I feel like the compiler doesn't actually generate any code for these anyway.

    Still, it would be cleaner to just remove them. Thanks for notifying.

  8. linked a pull request that will close this issueAnother round of Cppcheck fixes #3849on Feb 17, 2021
  9. added a commit that references this issue on Feb 18, 2021
  10. added a commit that references this issue on Mar 10, 2021
  11. added a commit that references this issue on Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working as expected

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions