sysfs.c (597473720f4dc69749542bfcfed4a927a43d935e) | sysfs.c (75b1a8f9d62e50f05d0e4e9f3c8bcde32527ffc1) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/kernel.h> 3#include <linux/of.h> 4#include <linux/stat.h> 5/* FIX UP */ 6#include "soundbus.h" 7 8static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 9 char *buf) 10{ 11 struct soundbus_dev *sdev = to_soundbus_device(dev); 12 struct platform_device *of = &sdev->ofdev; 13 int length; 14 15 if (*sdev->modalias) { | 1// SPDX-License-Identifier: GPL-2.0 2#include <linux/kernel.h> 3#include <linux/of.h> 4#include <linux/stat.h> 5/* FIX UP */ 6#include "soundbus.h" 7 8static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, 9 char *buf) 10{ 11 struct soundbus_dev *sdev = to_soundbus_device(dev); 12 struct platform_device *of = &sdev->ofdev; 13 int length; 14 15 if (*sdev->modalias) { |
16 strlcpy(buf, sdev->modalias, sizeof(sdev->modalias) + 1); | 16 strscpy(buf, sdev->modalias, sizeof(sdev->modalias) + 1); |
17 strcat(buf, "\n"); 18 length = strlen(buf); 19 } else { 20 length = sprintf(buf, "of:N%pOFn%c%s\n", 21 of->dev.of_node, 'T', 22 of_node_get_device_type(of->dev.of_node)); 23 } 24 --- 30 unchanged lines hidden --- | 17 strcat(buf, "\n"); 18 length = strlen(buf); 19 } else { 20 length = sprintf(buf, "of:N%pOFn%c%s\n", 21 of->dev.of_node, 'T', 22 of_node_get_device_type(of->dev.of_node)); 23 } 24 --- 30 unchanged lines hidden --- |