summaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/crypto/ap_bus.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index bf37cdf..5aac0ec 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -423,27 +423,25 @@ static int ap_uevent (struct device *dev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
struct ap_device *ap_dev = to_ap_dev(dev);
- int length;
+ int retval = 0, length = 0, i = 0;
if (!ap_dev)
return -ENODEV;
/* Set up DEV_TYPE environment variable. */
- envp[0] = buffer;
- length = scnprintf(buffer, buffer_size, "DEV_TYPE=%04X",
- ap_dev->device_type);
- if (buffer_size - length <= 0)
- return -ENOMEM;
- buffer += length;
- buffer_size -= length;
+ retval = add_uevent_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "DEV_TYPE=%04X", ap_dev->device_type);
+ if (retval)
+ return retval;
+
/* Add MODALIAS= */
- envp[1] = buffer;
- length = scnprintf(buffer, buffer_size, "MODALIAS=ap:t%02X",
- ap_dev->device_type);
- if (buffer_size - length <= 0)
- return -ENOMEM;
- envp[2] = NULL;
- return 0;
+ retval = add_uevent_var(envp, num_envp, &i,
+ buffer, buffer_size, &length,
+ "MODALIAS=ap:t%02X", ap_dev->device_type);
+
+ envp[i] = NULL;
+ return retval;
}
static struct bus_type ap_bus_type = {
OpenPOWER on IntegriCloud