sysfs: handle failure path correctly for readdir()