mcp251xfd: mcp251xfd_regmap_read(): don't assign return value of strchr() to char *#620
Merged
marckleinebudde merged 1 commit intolinux-can:masterfrom Mar 4, 2026
Conversation
…hr() to `char *`
The `file_path` of `strchr(file_path, '/')` is a `const char *`. In this
case the `strchr()` in debian experimental returns a `const char *`,
leading to this error message:
```
mcp251xfd/mcp251xfd-regmap.c:75:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
75 | tmp = strchr(file_path, '/');
| ^
```
Fix the error by using the return value from `strchr()` directly in the
`if()`.
Link: https://github.com/linux-can/can-utils/actions/runs/22649777324/job/65679726209?pr=619
8b65b6e to
aa902ae
Compare
char *strchr() to char *
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
file_pathofstrchr(file_path, '/')is aconst char *. In this case thestrchr()in debian experimental returns aconst char *, leading to this error message:Fix the error by using the return value from
strchr()directly in theif().Link: https://github.com/linux-can/can-utils/actions/runs/22649777324/job/65679726209?pr=619