Bug 102342 - mesa-17.1.7/src/gallium/auxiliary/pipebuffer/pb_cache.c:169]: (style) Suspicious condition
Summary: mesa-17.1.7/src/gallium/auxiliary/pipebuffer/pb_cache.c:169]: (style) Suspici...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/radeonsi (show other bugs)
Version: 17.1
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-21 16:56 UTC by dcb314
Modified: 2018-04-03 06:09 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description dcb314 2017-08-21 16:56:02 UTC
mesa-17.1.7/src/gallium/auxiliary/pipebuffer/pb_cache.c:169]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses.

Source code is

      if (!entry && (ret = pb_cache_is_buffer_compat(cur_entry, size,
                                                     alignment, usage) > 0))

maybe better code

      if (!entry && ((ret = pb_cache_is_buffer_compat(cur_entry, size,
                                                     alignment, usage)) > 0))
Comment 1 Timothy Arceri 2018-04-03 06:09:47 UTC
Thanks for reporting this.

Fixed by:

commit 7e9b7ec094500f1245eed518592f99244e54a753 (HEAD -> master, origin/master, origin/HEAD)
Author: Timothy Arceri <tarceri@itsqueeze.com>
Date:   Sun Apr 1 09:32:28 2018 +1000

    gallium/pipebuffer: fix parenthesis location
    
    Without this the return value will never get set to -1. This
    was first added in 49866c8f3457 and copied in 2b396eeed983.
    
    Fixes: 2b396eeed983 "gallium/pb_cache: add a copy of cache bufmgr independent of pb_manager"
    
    Reviewed-by: Marek Olšák <marek.olsak@amd.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102342


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.