Re: [PATCH 3/3 v2] drivers/bus: Device driver for FSL-MC DPRC devices

From: Timur Tabi
Date: Tue Sep 30 2014 - 22:35:52 EST


Scott Wood wrote:
> >+ if (num_child_objects_in_mc != 0) {
>
>Like here. Just do "if (num_child_objects_in_mc) {"

This seems to be a place that is testing for zero as a value rather than
as a stand-in for NULL, so I'd argue it's better style to leave it as
is.

But in this case, zero means "none left", so this is a perfectly valid use-case for omitting the !=.

strcmp() is the only time I can think of to put an explicit != 0, because this:

if (!strcmp(s1, s2))

is counter-intuitive.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/