With latest glibc (Fedora Rawhide):
../drivers/crypto/caam_jr/caam_jr_uio.c: In function
        'file_name_match_extract':
../drivers/crypto/caam_jr/caam_jr_uio.c:111:16: warning: assignment
        discards 'const' qualifier from pointer target type
        [-Wdiscarded-qualifiers]
  111 |         substr = strstr(filename, match);
      |                ^

Fixes: e7a45f3cc245 ("crypto/caam_jr: add UIO specific operations")
Cc: [email protected]

Signed-off-by: David Marchand <[email protected]>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c 
b/drivers/crypto/caam_jr/caam_jr_uio.c
index 8956f7750d..43357091e1 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -106,19 +106,11 @@ static int g_uio_jr_num;
 static bool
 file_name_match_extract(const char filename[], const char match[], int *number)
 {
-       char *substr = NULL;
-
-       substr = strstr(filename, match);
-       if (substr == NULL)
-               return false;
-
        /* substring <match> was found in <filename>
         * read number following <match> substring in <filename>
         */
-       if (sscanf(filename + strlen(match), "%d", number) <= 0)
-               return false;
-
-       return true;
+       return strstr(filename, match) != NULL &&
+               sscanf(filename + strlen(match), "%d", number) > 0;
 }
 
 /** @brief Reads first line from a file.
-- 
2.51.1

Reply via email to