This patch simplifies for() loop used in ahci_enumerate_ports(). It makes it more readable. Similar thing was done in b913501 ({platform,super}-intel: Fix two resource leaks). Signed-off-by: Pawel Baldysiak <pawel.baldysiak@xxxxxxxxx> --- super-intel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/super-intel.c b/super-intel.c index 8a80c5b..1bc3688 100644 --- a/super-intel.c +++ b/super-intel.c @@ -1624,7 +1624,10 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b * this hba */ dir = opendir("/sys/dev/block"); - for (ent = dir ? readdir(dir) : NULL; ent; ent = readdir(dir)) { + if (!dir) + return 1; + + for (ent = readdir(dir); ent; ent = readdir(dir)) { int fd; char model[64]; char vendor[64]; -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html