Re: [PATCH] checkpatch: Suggest using min_t or max_t
From: Andrew Morton
Date: Tue May 24 2011 - 19:35:17 EST
On Fri, 20 May 2011 13:24:48 -0700
Joe Perches <joe@xxxxxxxxxxx> wrote:
> A common issue with min() or max() is using a cast on
> one or both of the arguments when using min_t/max_t could
> be better.
>
> Add cast detection to uses of min/max and suggest an
> appropriate use of min_t or max_t instead.
Causes this:
akpm2:/usr/src/25> perl scripts/checkpatch.pl patches/drivers-gpio-vx855_gpioc-needs-slabh.patch
Nested quantifiers in regex; marked by <-- HERE in m/(\((?:[^\(\)]++ <-- HERE |(?-1))*\))/ at scripts/checkpatch.pl line 271.
with this:
From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
alpha allmodconfig:
drivers/gpio/vx855_gpio.c: In function 'vx855gpio_probe':
drivers/gpio/vx855_gpio.c:233: error: implicit declaration of function 'kzalloc'
drivers/gpio/vx855_gpio.c:233: warning: assignment makes pointer from integer without a cast
Cc: Grant Likely <grant.likely@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
drivers/gpio/vx855_gpio.c | 1 +
1 file changed, 1 insertion(+)
diff -puN drivers/gpio/vx855_gpio.c~drivers-gpio-vx855_gpioc-needs-slabh drivers/gpio/vx855_gpio.c
--- a/drivers/gpio/vx855_gpio.c~drivers-gpio-vx855_gpioc-needs-slabh
+++ a/drivers/gpio/vx855_gpio.c
@@ -26,6 +26,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/gpio.h>
+#include <linux/slab.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/pci.h>
_
--
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/