You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using sth. like the following code snippet to setup IIO devices and channels:
dev=iio_context_find_device(ctx, "iio-device-name");
err=iio_err(dev);
if (err) shutdown();
ch=iio_device_find_channel(dev, "voltage0", false);
In the normal case this works as expected. To test the error paths in my code, I just unloaded the IIO kernel driver being used and was greated with a null-ptr deref on dev in iio_device_find_channel(). The error could be easily fixed with an explicit NULL check:
if (err|| !dev) shutdown();
However, I wondered if iio_err() should handle this case implicitly to reduce the error handling boilerplate for users?