summaryrefslogtreecommitdiffstats
path: root/drivers/hte/hte.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:35:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:31 +0000
commit85c675d0d09a45a135bddd15d7b385f8758c32fb (patch)
tree76267dbc9b9a130337be3640948fe397b04ac629 /drivers/hte/hte.c
parentAdding upstream version 6.6.15. (diff)
downloadlinux-85c675d0d09a45a135bddd15d7b385f8758c32fb.tar.xz
linux-85c675d0d09a45a135bddd15d7b385f8758c32fb.zip
Adding upstream version 6.7.7.upstream/6.7.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/hte/hte.c')
-rw-r--r--drivers/hte/hte.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/hte/hte.c b/drivers/hte/hte.c
index 598a716b7..23a6eeb8c 100644
--- a/drivers/hte/hte.c
+++ b/drivers/hte/hte.c
@@ -17,8 +17,6 @@
#include <linux/debugfs.h>
#include <linux/device.h>
-#define HTE_TS_NAME_LEN 10
-
/* Global list of the HTE devices */
static DEFINE_SPINLOCK(hte_lock);
static LIST_HEAD(hte_devices);
@@ -88,7 +86,7 @@ struct hte_device {
struct list_head list;
struct hte_chip *chip;
struct module *owner;
- struct hte_ts_info ei[];
+ struct hte_ts_info ei[] __counted_by(nlines);
};
#ifdef CONFIG_DEBUG_FS
@@ -389,13 +387,10 @@ static int __hte_req_ts(struct hte_ts_desc *desc, hte_ts_cb_t cb,
atomic_inc(&gdev->ts_req);
- ei->line_name = NULL;
- if (!desc->attr.name) {
- ei->line_name = kzalloc(HTE_TS_NAME_LEN, GFP_KERNEL);
- if (ei->line_name)
- scnprintf(ei->line_name, HTE_TS_NAME_LEN, "ts_%u",
- desc->attr.line_id);
- }
+ if (desc->attr.name)
+ ei->line_name = NULL;
+ else
+ ei->line_name = kasprintf(GFP_KERNEL, "ts_%u", desc->attr.line_id);
hte_ts_dbgfs_init(desc->attr.name == NULL ?
ei->line_name : desc->attr.name, ei);