Re: [PATCH] checkpatch: Warn on comparisons to true and false

From: Joe Perches
Date: Thu Apr 11 2013 - 10:25:24 EST


On Thu, 2013-04-11 at 13:56 +0200, Bjørn Mork wrote:
> I felt I had to share this little gem
> which showed up in drivers/gpu/drm/exynos/exynos_drm_vidi.c:
>
> static int vidi_power_on(struct vidi_context *ctx, bool enable)
> {
> struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
> struct device *dev = subdrv->dev;
>
> DRM_DEBUG_KMS("%s\n", __FILE__);
>
> if (enable != false && enable != true)
> return -EINVAL;
> ..
> That's taking failsafe to the next step :)

Cute. It's a relatively new driver too so I'd guess
the "int -> bool conversion leftover" defense isn't
too likely.

--
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/