From: Antonio Ospite Date: Tue, 27 Feb 2018 17:41:44 +0000 (+0100) Subject: am7xxx: return EINVAL instead of ENOTSUP in am7xxx_get_device_info() X-Git-Tag: v0.1.7~16 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/627f4b2385f08222e7a38dec6066ac0c710a251b 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. --- 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));