linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] checkpatch: Suggest using min_t or max_t
Date: Tue, 24 May 2011 16:35:03 -0700	[thread overview]
Message-ID: <20110524163503.0cd73903.akpm@linux-foundation.org> (raw)
In-Reply-To: <1305923088.4209.79.camel@Joe-Laptop>

On Fri, 20 May 2011 13:24:48 -0700
Joe Perches <joe@perches.com> 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@linux-foundation.org>

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@secretlab.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

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


  reply	other threads:[~2011-05-24 23:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 12:21 [PATCH v3] w1: Add Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC support Clifton Barnes
2011-05-19 19:03 ` Andrew Morton
2011-05-19 20:21 ` Ryan Mallon
     [not found] ` <20110519115859.e11a7ca3.akpm@linux-foundation.org>
     [not found]   ` <1305909981.4209.33.camel@Joe-Laptop>
     [not found]     ` <20110520095037.25eadc0a.akpm@linux-foundation.org>
     [not found]       ` <1305912602.4209.41.camel@Joe-Laptop>
     [not found]         ` <20110520103529.1ef3917c.akpm@linux-foundation.org>
     [not found]           ` <1305915161.4209.56.camel@Joe-Laptop>
     [not found]             ` <20110520113830.3faf5230.akpm@linux-foundation.org>
2011-05-20 20:24               ` [PATCH] checkpatch: Suggest using min_t or max_t Joe Perches
2011-05-24 23:35                 ` Andrew Morton [this message]
2011-05-25  0:11                   ` Joe Perches
2011-05-25 23:53                     ` Andrew Morton
2011-05-27  0:35                       ` [PATCH v2] " Joe Perches
2012-09-05 11:21                         ` Philippe De Muyter
2012-09-05 17:07                           ` Joe Perches
2012-09-06  0:16                             ` Philippe De Muyter
2012-09-06  0:35                               ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110524163503.0cd73903.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).