Skip to content

Commit 8a1d24a

Browse files
committed
rproc: Make state update errors more helpful
Include the reason for the failure to update the "state" sysfs attribtue in the error message. Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 3449744 commit 8a1d24a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

rproc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ static void *do_rproc_start(void *unused)
176176
ssize_t ret;
177177

178178
ret = pwrite(rproc_state_fd, "start", 5, 0);
179-
if (ret < 4)
180-
fprintf(stderr, "failed to update start state\n");
179+
if (ret < 4) {
180+
fprintf(stderr, "failed to update start state: %s\n",
181+
strerror(errno));
182+
}
181183

182184
return NULL;
183185
}
@@ -192,8 +194,10 @@ static void *do_rproc_stop(void *unused)
192194
ssize_t ret;
193195

194196
ret = pwrite(rproc_state_fd, "stop", 4, 0);
195-
if (ret < 4)
196-
fprintf(stderr, "failed to update stop state\n");
197+
if (ret < 4) {
198+
fprintf(stderr, "failed to update stop state: %s\n",
199+
strerror(errno));
200+
}
197201

198202
ret = write(rproc_pipe[1], "Y", 1);
199203
if (ret != 1) {

0 commit comments

Comments
 (0)