1. 11 Sep, 2018 1 commit
    • Rohit kumar's avatar
      ASoC: Fix UBSAN warning at snd_soc_get/put_volsw_sx() · ae7d1247
      Rohit kumar authored
      In functions snd_soc_get_volsw_sx() or snd_soc_put_volsw_sx(),
      if the result of (min + max) is negative, then fls() returns
      signed integer with value as 32. This leads to signed integer
      overflow as complete operation is considered as signed integer.
      
      UBSAN: Undefined behaviour in sound/soc/soc-ops.c:382:50
      signed integer overflow:
      -2147483648 - 1 cannot be represented in type 'int'
      Call trace:
      [<ffffff852f746fe4>] __dump_stack lib/dump_stack.c:15 [inline]
      [<ffffff852f746fe4>] dump_stack+0xec/0x158 lib/dump_stack.c:51
      [<ffffff852f7b5f3c>] ubsan_epilogue+0x18/0x50 lib/ubsan.c:164
      [<ffffff852f7b6840>] handle_overflow+0xf8/0x130 lib/ubsan.c:195
      [<ffffff852f7b68f0>] __ubsan_handle_sub_overflow+0x34/0x44 lib/ubsan.c:211
      [<ffffff85307971a0>] snd_soc_get_volsw_sx+0x1a8/0x1f8 sound/soc/soc-ops.c:382
      
      Typecast the operation to unsigned int to fix the issue.
      Signed-off-by: default avatarRohit kumar <rohitkr@codeaurora.org>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      ae7d1247
  2. 10 Sep, 2018 19 commits
  3. 07 Sep, 2018 3 commits
  4. 06 Sep, 2018 7 commits
  5. 05 Sep, 2018 6 commits
  6. 04 Sep, 2018 3 commits
  7. 03 Sep, 2018 1 commit
    • Jon Hunter's avatar
      ASoC: core: Don't schedule DAPM work if already in target state · e03546dd
      Jon Hunter authored
      When dapm_power_widgets() is called, the dapm_pre_sequence_async() and
      dapm_post_sequence_async() functions are scheduled for all DAPM contexts
      (apart from the card DAPM context) regardless of whether the DAPM
      context is already in the desired state. The overhead of this is not
      insignificant and the more DAPM contexts there are the more overhead
      there is.
      
      For example, on the Tegra124 Jetson TK1, when profiling the time taken
      to execute the dapm_power_widgets() the following times were observed.
      
        Times for function dapm_power_widgets() are (us):
           Min 23, Ave 190, Max 434, Count 39
      
      Here 'Count' is the number of times that dapm_power_widgets() has been
      called. Please note that the above time were measured using ktime_get()
      to log the time on entry and exit from dapm_power_widgets(). So it
      should be noted that these times may not be purely the time take to
      execute this function if it is preempted. However, after applying this
      patch and measuring the time taken to execute dapm_power_widgets() again
      a significant improvement is seen as shown below.
      
        Times for function dapm_power_widgets() are (us):
           Min 4, Ave 16, Max 82, Count 39
      
      Therefore, optimise the dapm_power_widgets() function by only scheduling
      the dapm_pre/post_sequence_async() work if the DAPM context is not in
      the desired state.
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      e03546dd