Skip to content

Commit 982c595

Browse files
Qing Wangbebarino
authored andcommitted
clk-si5341: replace snprintf in show functions with sysfs_emit
coccicheck complains about the use of snprintf() in sysfs show functions. Fix the following coccicheck warning: drivers/clk/clk-si5341.c:1471: WARNING: use scnprintf or sprintf. drivers/clk/clk-si5341.c:1486: WARNING: use scnprintf or sprintf. drivers/clk/clk-si5341.c:1501: WARNING: use scnprintf or sprintf. drivers/clk/clk-si5341.c:1516: WARNING: use scnprintf or sprintf. Use sysfs_emit instead of scnprintf or sprintf makes more sense. Signed-off-by: Qing Wang <wangqing@vivo.com> Link: https://lore.kernel.org/r/1634280331-4150-1-git-send-email-wangqing@vivo.com Reviewed-by: Robert Hancock <robert.hancock@calian.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 2a8b539 commit 982c595

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/clk/clk-si5341.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ static ssize_t input_present_show(struct device *dev,
14701470
if (res < 0)
14711471
return res;
14721472
res = !(status & SI5341_STATUS_LOSREF);
1473-
return snprintf(buf, PAGE_SIZE, "%d\n", res);
1473+
return sysfs_emit(buf, "%d\n", res);
14741474
}
14751475
static DEVICE_ATTR_RO(input_present);
14761476

@@ -1485,7 +1485,7 @@ static ssize_t input_present_sticky_show(struct device *dev,
14851485
if (res < 0)
14861486
return res;
14871487
res = !(status & SI5341_STATUS_LOSREF);
1488-
return snprintf(buf, PAGE_SIZE, "%d\n", res);
1488+
return sysfs_emit(buf, "%d\n", res);
14891489
}
14901490
static DEVICE_ATTR_RO(input_present_sticky);
14911491

@@ -1500,7 +1500,7 @@ static ssize_t pll_locked_show(struct device *dev,
15001500
if (res < 0)
15011501
return res;
15021502
res = !(status & SI5341_STATUS_LOL);
1503-
return snprintf(buf, PAGE_SIZE, "%d\n", res);
1503+
return sysfs_emit(buf, "%d\n", res);
15041504
}
15051505
static DEVICE_ATTR_RO(pll_locked);
15061506

@@ -1515,7 +1515,7 @@ static ssize_t pll_locked_sticky_show(struct device *dev,
15151515
if (res < 0)
15161516
return res;
15171517
res = !(status & SI5341_STATUS_LOL);
1518-
return snprintf(buf, PAGE_SIZE, "%d\n", res);
1518+
return sysfs_emit(buf, "%d\n", res);
15191519
}
15201520
static DEVICE_ATTR_RO(pll_locked_sticky);
15211521

0 commit comments

Comments
 (0)