Commit 2a998392 authored by Qing Wang's avatar Qing Wang Committed by Mauro Carvalho Chehab

media: i2c: ccs: replace snprintf in show functions with sysfs_emit

show() should not use snprintf() when formatting the value to be
returned to user space.

Fix the following coccicheck warning:
drivers/media/i2c/ccs/ccs-core.c:3761: WARNING: use scnprintf or sprintf.
Signed-off-by: default avatarQing Wang <wangqing@vivo.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 85db29d2
...@@ -2758,13 +2758,13 @@ ident_show(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -2758,13 +2758,13 @@ ident_show(struct device *dev, struct device_attribute *attr, char *buf)
struct ccs_module_info *minfo = &sensor->minfo; struct ccs_module_info *minfo = &sensor->minfo;
if (minfo->mipi_manufacturer_id) if (minfo->mipi_manufacturer_id)
return snprintf(buf, PAGE_SIZE, "%4.4x%4.4x%2.2x\n", return sysfs_emit(buf, "%4.4x%4.4x%2.2x\n",
minfo->mipi_manufacturer_id, minfo->model_id, minfo->mipi_manufacturer_id, minfo->model_id,
minfo->revision_number) + 1; minfo->revision_number) + 1;
else else
return snprintf(buf, PAGE_SIZE, "%2.2x%4.4x%2.2x\n", return sysfs_emit(buf, "%2.2x%4.4x%2.2x\n",
minfo->smia_manufacturer_id, minfo->model_id, minfo->smia_manufacturer_id, minfo->model_id,
minfo->revision_number) + 1; minfo->revision_number) + 1;
} }
static DEVICE_ATTR_RO(ident); static DEVICE_ATTR_RO(ident);
......
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