Currently, devlink silently exits when a non-existent device is specified for flashing or when the user lacks sufficient permissions. This makes it hard to diagnose the problem. Print an appropriate error message in these cases to improve user feedback. Prior: $ devlink dev flash foo/bar file test $ sudo devlink dev flash foo/bar file test $ After patch: $ devlink/devlink dev flash foo/bar file test devlink answers: Operation not permitted $ sudo devlink/devlink dev flash foo/bar file test devlink answers: No such device Fixes: 9b13cddfe268 ("devlink: implement flash status monitoring") Signed-off-by: Ivan Vecera --- devlink/devlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devlink/devlink.c b/devlink/devlink.c index 171b85327be3..b162cf4050f9 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -4594,6 +4594,8 @@ static int cmd_dev_flash(struct dl *dl) } while (!ctx.flash_done || (ctx.not_first && !ctx.received_end)); err = mnlu_gen_socket_recv_run(&dl->nlg, NULL, NULL); + if (err < 0) + pr_err("devlink answers: %s\n", strerror(errno)); out: close(pipe_r); -- 2.51.0