Commit 9bea6216 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Andrew Morton

dyndbg: replace kstrdup() + strchr() with kstrdup_and_replace()

Replace open coded functionalify of kstrdup_and_replace() with a call.

Link: https://lkml.kernel.org/r/20240213162741.3102810-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 2932fb0a
...@@ -640,10 +640,9 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa ...@@ -640,10 +640,9 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa
int cls_id, totct = 0; int cls_id, totct = 0;
bool wanted; bool wanted;
cl_str = tmp = kstrdup(instr, GFP_KERNEL); cl_str = tmp = kstrdup_and_replace(instr, '\n', '\0', GFP_KERNEL);
p = strchr(cl_str, '\n'); if (!tmp)
if (p) return -ENOMEM;
*p = '\0';
/* start with previously set state-bits, then modify */ /* start with previously set state-bits, then modify */
curr_bits = old_bits = *dcp->bits; curr_bits = old_bits = *dcp->bits;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment