mcp251xfd: mcp251xfd_regmap_read(): don't assign return value of strchr() 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
pull/620/head
Marc Kleine-Budde 2026-03-04 11:14:54 +01:00
parent a0b592178e
commit aa902ae2af
1 changed files with 1 additions and 2 deletions

View File

@ -72,8 +72,7 @@ int mcp251xfd_regmap_read(struct mcp251xfd_priv *priv,
return 0;
/* maybe it's something like "spi0.0" */
tmp = strchr(file_path, '/');
if (tmp)
if (strchr(file_path, '/'))
return -ENOENT;
/* first try literally */