mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
hte: Use kasprintf() instead of fixed buffer formatting
Improve readability and maintainability by replacing a hardcoded string allocation and formatting by the use of the kasprintf() helper. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Dipen Patel <dipenp@nvidia.com> Signed-off-by: Dipen Patel <dipenp@nvidia.com>
This commit is contained in:
parent
b7c3ca3553
commit
fc62d5e214
1 changed files with 4 additions and 9 deletions
|
@ -17,8 +17,6 @@
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
|
||||||
#define HTE_TS_NAME_LEN 10
|
|
||||||
|
|
||||||
/* Global list of the HTE devices */
|
/* Global list of the HTE devices */
|
||||||
static DEFINE_SPINLOCK(hte_lock);
|
static DEFINE_SPINLOCK(hte_lock);
|
||||||
static LIST_HEAD(hte_devices);
|
static LIST_HEAD(hte_devices);
|
||||||
|
@ -389,13 +387,10 @@ static int __hte_req_ts(struct hte_ts_desc *desc, hte_ts_cb_t cb,
|
||||||
|
|
||||||
atomic_inc(&gdev->ts_req);
|
atomic_inc(&gdev->ts_req);
|
||||||
|
|
||||||
ei->line_name = NULL;
|
if (desc->attr.name)
|
||||||
if (!desc->attr.name) {
|
ei->line_name = NULL;
|
||||||
ei->line_name = kzalloc(HTE_TS_NAME_LEN, GFP_KERNEL);
|
else
|
||||||
if (ei->line_name)
|
ei->line_name = kasprintf(GFP_KERNEL, "ts_%u", desc->attr.line_id);
|
||||||
scnprintf(ei->line_name, HTE_TS_NAME_LEN, "ts_%u",
|
|
||||||
desc->attr.line_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
hte_ts_dbgfs_init(desc->attr.name == NULL ?
|
hte_ts_dbgfs_init(desc->attr.name == NULL ?
|
||||||
ei->line_name : desc->attr.name, ei);
|
ei->line_name : desc->attr.name, ei);
|
||||||
|
|
Loading…
Add table
Reference in a new issue