From 627f4b2385f08222e7a38dec6066ac0c710a251b Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 27 Feb 2018 18:41:44 +0100 Subject: [PATCH] am7xxx: return EINVAL instead of ENOTSUP in am7xxx_get_device_info() All the other error paths about invalid results or unsupported operations return EINVAL, so remove the only instance of ENOTSUP. Since the API documentation makes no promises on the actual negative value of the returned error, this little change of behavior should be fine. --- src/am7xxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/am7xxx.c b/src/am7xxx.c index 4bf9abb..8573a59 100644 --- a/src/am7xxx.c +++ b/src/am7xxx.c @@ -1240,8 +1240,8 @@ AM7XXX_PUBLIC int am7xxx_get_device_info(am7xxx_device *dev, if (h.packet_type != AM7XXX_PACKET_TYPE_DEVINFO) { error(dev->ctx, "expected packet type: %d, got %d instead!\n", AM7XXX_PACKET_TYPE_DEVINFO, h.packet_type); - errno = ENOTSUP; - return -ENOTSUP; + errno = EINVAL; + return -EINVAL; } dev->device_info = malloc(sizeof(*dev->device_info)); -- 2.1.4