]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/imagination: Fixed warning due to implicit cast to bool
authorDonald Robson <donald.robson@imgtec.com>
Thu, 30 Nov 2023 16:00:13 +0000 (16:00 +0000)
committerMaxime Ripard <mripard@kernel.org>
Mon, 4 Dec 2023 08:41:34 +0000 (09:41 +0100)
This line appears to confuse the compiler and had been noticed previously in
clang-tidy output. There isn't anything fundamentally wrong that I can see.
I suspect that it just looks like a mistake - hence the first note.  By making
the second operand an actual bool result, const correctness can be preserved
while silencing the warning.

>> drivers/gpu/drm/imagination/pvr_device_info.c:230:47: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
     230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
         |                                                      ^  ~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/imagination/pvr_device_info.c:230:47: note: use '&' for a bitwise operation
     230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
         |                                                      ^~
         |                                                      &
   drivers/gpu/drm/imagination/pvr_device_info.c:230:47: note: remove constant to silence this warning
     230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
         |                                                     ~^~~~~~~~~~~~~~~~~~~~~
   1 warning generated.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311241752.3iLyyFcA-lkp@intel.com/
Fixes: f99f5f3ea7ef ("drm/imagination: Add GPU ID parsing and firmware loading")
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231130160017.259902-1-donald.robson@imgtec.com
drivers/gpu/drm/imagination/pvr_device_info.c

index 11e6bef52ecd01dc5dcf05e8fa1774ad0d0b897c..d3301cde7d119e7dc0f04f5a069d49e187ef7925 100644 (file)
@@ -227,7 +227,8 @@ int pvr_device_info_set_features(struct pvr_device *pvr_dev, const u64 *features
        /* Verify no unsupported values in the bitmask. */
        if (features_size > mapping_max_size) {
                drm_warn(from_pvr_device(pvr_dev), "Unsupported features in firmware image");
-       } else if (features_size == mapping_max_size && (mapping_max & 63)) {
+       } else if (features_size == mapping_max_size &&
+                  ((mapping_max & 63) != 0)) {
                u64 invalid_mask = ~0ull << (mapping_max & 63);
 
                if (features[features_size - 1] & invalid_mask)