Skip to content

Another round of Cppcheck fixes - #3849

Merged
dbaluta merged 5 commits into
thesofproject:masterfrom
cujomalainey:cppcheck
Feb 18, 2021
Merged

dbaluta merged 5 commits into
thesofproject:masterfrom
cujomalainey:cppcheck

Conversation

@cujomalainey

Copy link
Copy Markdown
Contributor

No description provided.

ternary isn't entirely clear what order happens on the left, add
brackets to clarify. Cppcheck complaint

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Ret is unconditionally set later, so initialization is irrelevant.
Cppcheck find.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
cppcheck complaint

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Cppcheck complaint
Related to #3843

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
There is a bug in upstream cppcheck where dereferencing a pointer does
not result in a type check in sizeof as far as cppcheck is concerned.
This results in a false divide by sizeof(pointer) error.

See https://trac.cppcheck.net/ticket/10179

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
@cujomalainey cujomalainey linked an issue Feb 17, 2021 that may be closed by this pull request
Comment thread src/drivers/imx/edma.c
(void)handshake;
(void)irq;

tr_info(&edma_tr, "EDMA: set config");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered #if 0 for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkpatch gets mad at that, tried it for the pdm_controllers_configuration removal

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marc-hb @cujomalainey I'm fine with this change. There is git history to keep this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't find in git history what you don't even know exists, that's why it's sometimes worth keeping some dead code. In fact it's not straight forward to find deleted code in git history even when you know it was deleted. Emphasis on sometimes because I do NOT know this particular code, so maybe this one is NOT worth keeping despite the comment saying it should be kept.

As documented by the checkpatch maintainer, checkpatch is not always right and unlike cppcheck it's incremental so easy to ignore from time to time.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marc-hb In this specific case I'm fine with dropping the code despite my original comment. Something changed in handshake handling in the ESAI and SAI drivers and this code was indeed stale. Removing was the correct action.

@paulstelian97 paulstelian97 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.MX specific patches look good, the others I believe are also ok but can't fully validate.

@dbaluta
dbaluta merged commit 06d785c into thesofproject:master Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][Cppcheck][EDMA] unused variables

6 participants