Skip to content

Commit 8eac037

Browse files
Ansuellag-linaro
authored andcommitted
leds: leds-lp5523: Convert to sysfs_emit API
Convert sprintf to the much safer sysfs_emit API to handle output for sysfs. Signed-off-by: Christian Marangi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 6f2fdde commit 8eac037

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/leds/leds-lp5523.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ static ssize_t lp5523_selftest(struct device *dev,
245245
goto fail;
246246

247247
if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM)
248-
pos += sprintf(buf + pos, "LED %d FAIL\n",
249-
led->chan_nr);
248+
pos += sysfs_emit_at(buf, pos, "LED %d FAIL\n",
249+
led->chan_nr);
250250

251251
lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + led->chan_nr,
252252
0x00);
@@ -257,10 +257,10 @@ static ssize_t lp5523_selftest(struct device *dev,
257257
led++;
258258
}
259259
if (pos == 0)
260-
pos = sprintf(buf, "OK\n");
260+
pos = sysfs_emit(buf, "OK\n");
261261
goto release_lock;
262262
fail:
263-
pos = sprintf(buf, "FAIL\n");
263+
pos = sysfs_emit(buf, "FAIL\n");
264264

265265
release_lock:
266266
mutex_unlock(&chip->lock);

0 commit comments

Comments
 (0)