Re: [PATCH] drm: enable warnings on unused static inlines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 04 Sep 2024, Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
> Hi Jani,
>
> On Wed, Sep 04, 2024 at 03:38:19PM +0300, Jani Nikula wrote:
>> We enable most W=1 warnings by default subsystem wide. Also enable
>> warnings on unused static inlines when building with clang.
>> 
>> See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
>> inline functions for W=1 build").
>> 
>> Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
>> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
>> ---
>>  drivers/gpu/drm/Makefile | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
>> index 784229d4504d..6bd2cdb08be7 100644
>> --- a/drivers/gpu/drm/Makefile
>> +++ b/drivers/gpu/drm/Makefile
>> @@ -19,6 +19,9 @@ subdir-ccflags-y += $(call cc-option, -Wformat-overflow)
>>  # FIXME: fix -Wformat-truncation warnings and uncomment
>>  #subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
>>  subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
>> +
>> +subdir-ccflags-y += -DKBUILD_EXTRA_WARN1
>> +
>>  # The following turn off the warnings enabled by -Wextra
>>  ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
>>  subdir-ccflags-y += -Wno-missing-field-initializers
>> -- 
>> 2.39.2
>> 
>
> I ran this through my test matrix and this is what it found (across
> various configuration options, I can give specifics as necessary):

Thanks, I didn't really expect this would not catch anything. :)

We've already fixed some in drm-misc-next and drm-intel-next, see
below. Will need to fix more before merging, obviously.

BR,
Jani.

> drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c:30:18: warning: unused function 'hdmi_read' [-Wunused-function]
>    30 | static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset)
>       |                  ^~~~~~~~~
>
> drivers/gpu/drm/bridge/ti-sn65dsi86.c:1638:19: warning: unused function 'ti_sn_pwm_pin_request' [-Wunused-function]
>  1638 | static inline int ti_sn_pwm_pin_request(struct ti_sn65dsi86 *pdata) { return 0; }
>       |                   ^~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/bridge/ti-sn65dsi86.c:1639:20: warning: unused function 'ti_sn_pwm_pin_release' [-Wunused-function]
>  1639 | static inline void ti_sn_pwm_pin_release(struct ti_sn65dsi86 *pdata) {}
>       |                    ^~~~~~~~~~~~~~~~~~~~~
>
> drivers/gpu/drm/drm_mm.c:152:1: warning: unused function 'drm_mm_interval_tree_insert' [-Wunused-function]
>   152 | INTERVAL_TREE_DEFINE(struct drm_mm_node, rb,
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   153 |                      u64, __subtree_last,
>       |                      ~~~~~~~~~~~~~~~~~~~~
>   154 |                      START, LAST, static inline, drm_mm_interval_tree)
>       |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/interval_tree_generic.h:38:15: note: expanded from macro 'INTERVAL_TREE_DEFINE'
>    38 | ITSTATIC void ITPREFIX ## _insert(ITSTRUCT *node,                             \
>       |               ^~~~~~~~~~~~~~~~~~~
> <scratch space>:38:1: note: expanded from here
>    38 | drm_mm_interval_tree_insert
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/drm_mm.c:152:1: warning: unused function 'drm_mm_interval_tree_iter_next' [-Wunused-function]
>   152 | INTERVAL_TREE_DEFINE(struct drm_mm_node, rb,
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   153 |                      u64, __subtree_last,
>       |                      ~~~~~~~~~~~~~~~~~~~~
>   154 |                      START, LAST, static inline, drm_mm_interval_tree)
>       |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/interval_tree_generic.h:151:33: note: expanded from macro 'INTERVAL_TREE_DEFINE'
>   151 | ITSTATIC ITSTRUCT *                                                           \
>       |                                                                               ^
>   152 | ITPREFIX ## _iter_next(ITSTRUCT *node, ITTYPE start, ITTYPE last)             \
>       | ~~~~~~~~~~~~~~~~~~~~~~
> <scratch space>:50:1: note: expanded from here
>    50 | drm_mm_interval_tree_iter_next
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

53bd7c1c0077 ("drm/mm: Mark drm_mm_interval_tree*() functions with __maybe_unused")


> drivers/gpu/drm/drm_mm.c:614:20: warning: function 'drm_mm_node_scanned_block' is not needed and will not be emitted [-Wunneeded-internal-declaration]
>   614 | static inline bool drm_mm_node_scanned_block(const struct drm_mm_node *node)
>       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~

461ed4aad018 ("drm/mm: annotate drm_mm_node_scanned_block() with __maybe_unused")

> drivers/gpu/drm/i915/i915_sw_fence.c:97:20: error: unused function 'debug_fence_init_onstack' [-Werror,-Wunused-function]
>    97 | static inline void debug_fence_init_onstack(struct i915_sw_fence *fence)
>       |                    ^~~~~~~~~~~~~~~~~~~~~~~~

fcd9e8afd546 ("drm/i915/fence: Mark debug_fence_init_onstack() with __maybe_unused")

> drivers/gpu/drm/i915/i915_sw_fence.c:118:20: error: unused function 'debug_fence_free' [-Werror,-Wunused-function]
>   118 | static inline void debug_fence_free(struct i915_sw_fence *fence)
>       |                    ^~~~~~~~~~~~~~~~

f99999536128 ("drm/i915/fence: Mark debug_fence_free() with __maybe_unused")

>
> drivers/gpu/drm/imagination/pvr_drv.c:224:1: warning: unused function 'pvr_fw_version_packed' [-Wunused-function]
>   224 | pvr_fw_version_packed(u32 major, u32 minor)
>       | ^~~~~~~~~~~~~~~~~~~~~
>
> drivers/gpu/drm/kmb/kmb_dsi.c:822:2: warning: unused function 'set_test_mode_src_osc_freq_target_low_bits' [-Wunused-function]
>   822 |         set_test_mode_src_osc_freq_target_low_bits(struct kmb_dsi *kmb_dsi,
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/kmb/kmb_dsi.c:834:2: warning: unused function 'set_test_mode_src_osc_freq_target_hi_bits' [-Wunused-function]
>   834 |         set_test_mode_src_osc_freq_target_hi_bits(struct kmb_dsi *kmb_dsi,
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> drivers/gpu/drm/meson/meson_dw_hdmi.c:276:20: warning: unused function 'dw_hdmi_dwc_write_bits' [-Wunused-function]
>   276 | static inline void dw_hdmi_dwc_write_bits(struct meson_dw_hdmi *dw_hdmi,
>       |                    ^~~~~~~~~~~~~~~~~~~~~~
>
> drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c:35:19: warning: unused function 'rcar_cmm_read' [-Wunused-function]
>    35 | static inline int rcar_cmm_read(struct rcar_cmm *rcmm, u32 reg)
>       |                   ^~~~~~~~~~~~~
>
> drivers/gpu/drm/stm/ltdc.c:494:35: warning: unused function 'encoder_to_ltdc' [-Wunused-function]
>   494 | static inline struct ltdc_device *encoder_to_ltdc(struct drm_encoder *enc)
>       |                                   ^~~~~~~~~~~~~~~
>
> Cheers,
> Nathan

-- 
Jani Nikula, Intel



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux