X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fcommon%2Fjoystick.c;h=f75ae3d384bb79e9e14778918f695b0b4b6fc33f;hp=455ff19b9d759c2f536b0d8c73ff873f3622e19d;hb=c78f9ec47ba92b74698dacdae963dbbefd9b676f;hpb=66bf929fa97fabb70198455f9eec2e9ccf0661fa diff --git a/ui/common/joystick.c b/ui/common/joystick.c index 455ff19..f75ae3d 100644 --- a/ui/common/joystick.c +++ b/ui/common/joystick.c @@ -47,7 +47,7 @@ int pjs_process_event(const struct pjs *pjs) result = read(pjs->fd, &e, sizeof(e)); if (result != sizeof(e)) { - pb_log("%s: read failed: %s\n", __func__, strerror(errno)); + pb_log_fn("read failed: %s\n", strerror(errno)); return 0; } @@ -86,7 +86,7 @@ struct pjs *pjs_init(void *ctx, int (*map)(const struct js_event *)) pjs->fd = open(dev_name, O_RDONLY | O_NONBLOCK); if (pjs->fd < 0) { - pb_log("%s: open %s failed: %s\n", __func__, dev_name, + pb_log_fn("open %s failed: %s\n", dev_name, strerror(errno)); goto out_err; } @@ -98,8 +98,8 @@ struct pjs *pjs_init(void *ctx, int (*map)(const struct js_event *)) return pjs; out_err: - close(pjs->fd); - pjs->fd = 0; + if (pjs->fd >= 0) + close(pjs->fd); talloc_free(pjs); return NULL; }