Merge "asoc: Ratelimit error logs to avoid excessive logging"

This commit is contained in:
Linux Build Service Account 2019-06-09 08:03:25 -07:00 committed by Gerrit - the friendly Code Review server
commit 84253b6fc6

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2017, 2019 The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -11,6 +11,7 @@
*/ */
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/ratelimit.h>
#include <sound/apr_audio-v2.h> #include <sound/apr_audio-v2.h>
#include <sound/q6asm-v2.h> #include <sound/q6asm-v2.h>
#include <sound/compress_params.h> #include <sound/compress_params.h>
@ -23,7 +24,8 @@
#define GET_NEXT(ptr, upper_limit, rc) \ #define GET_NEXT(ptr, upper_limit, rc) \
({ \ ({ \
if (((ptr) + 1) > (upper_limit)) { \ if (((ptr) + 1) > (upper_limit)) { \
pr_err("%s: param list out of boundary\n", __func__); \ pr_err_ratelimited("%s: param list out of boundary\n", \
__func__); \
(rc) = -EINVAL; \ (rc) = -EINVAL; \
} \ } \
((rc) == 0) ? *(ptr)++ : -EINVAL; \ ((rc) == 0) ? *(ptr)++ : -EINVAL; \
@ -32,7 +34,8 @@
#define CHECK_PARAM_LEN(len, max_len, tag, rc) \ #define CHECK_PARAM_LEN(len, max_len, tag, rc) \
do { \ do { \
if ((len) > (max_len)) { \ if ((len) > (max_len)) { \
pr_err("%s: params length overflows\n", (tag)); \ pr_err_ratelimited("%s: params length overflows\n", \
(tag)); \
(rc) = -EINVAL; \ (rc) = -EINVAL; \
} \ } \
} while (0) } while (0)
@ -234,7 +237,8 @@ int msm_audio_effects_virtualizer_handler(struct audio_client *ac,
param_data = (u8 *) &virtualizer->gain_adjust; param_data = (u8 *) &virtualizer->gain_adjust;
break; break;
default: default:
pr_err("%s: Invalid command to set config\n", __func__); pr_err_ratelimited("%s: Invalid command to set config\n",
__func__);
continue; continue;
} }
if (rc) if (rc)
@ -656,7 +660,8 @@ int msm_audio_effects_reverb_handler(struct audio_client *ac,
param_data = (u8 *) &reverb->density; param_data = (u8 *) &reverb->density;
break; break;
default: default:
pr_err("%s: Invalid command to set config\n", __func__); pr_err_ratelimited("%s: Invalid command to set config\n",
__func__);
continue; continue;
} }
if (rc) if (rc)
@ -797,7 +802,8 @@ int msm_audio_effects_bass_boost_handler(struct audio_client *ac,
param_data = (u8 *) &bass_boost->strength; param_data = (u8 *) &bass_boost->strength;
break; break;
default: default:
pr_err("%s: Invalid command to set config\n", __func__); pr_err_ratelimited("%s: Invalid command to set config\n",
__func__);
continue; continue;
} }
if (rc) if (rc)
@ -910,7 +916,8 @@ int msm_audio_effects_pbe_handler(struct audio_client *ac,
param_data = (u8 *) values; param_data = (u8 *) values;
break; break;
default: default:
pr_err("%s: Invalid command to set config\n", __func__); pr_err_ratelimited("%s: Invalid command to set config\n",
__func__);
continue; continue;
} }
if (rc) if (rc)
@ -1151,7 +1158,8 @@ int msm_audio_effects_popless_eq_handler(struct audio_client *ac,
param_data = (u8 *) &eq->freq_millihertz; param_data = (u8 *) &eq->freq_millihertz;
break; break;
default: default:
pr_err("%s: Invalid command to set config\n", __func__); pr_err_ratelimited("%s: Invalid command to set config\n",
__func__);
continue; continue;
} }
if (rc) if (rc)
@ -1270,7 +1278,7 @@ static int __msm_audio_effects_volume_handler(struct audio_client *ac,
"VOLUME/VOLUME2_GAIN_MASTER", rc); "VOLUME/VOLUME2_GAIN_MASTER", rc);
break; break;
default: default:
pr_err("%s: Invalid command id: %d to set config\n", pr_err_ratelimited("%s: Invalid command id: %d to set config\n",
__func__, command_id); __func__, command_id);
continue; continue;
} }