2007-08-16 13:19:24

by Andy Whitcroft

[permalink] [raw]
Subject: [PATCH 0/6] checkpatch checks for trailing semicolons on conditionals

A couple of people suggested adding checks to checkpatch for trailing
semicolons on conditionals, where the conditional block may not be
actually conditional:

if (err);
return err;

While regression testing the changes, I ran these checks across the
whole of 2.6.23-rc3 and there appear to be 5 places where this is
occurs (above and beyond the IPv6 one which triggered this effort)
and a benign use which could be confused later which it seems safest
to fix.

Following this email are 6 patches for these issues, relevant
maintainers cc'd. All against 2.6.23-rc3

-apw


2007-08-16 14:08:50

by Satyam Sharma

[permalink] [raw]
Subject: Re: [PATCH 0/6] checkpatch checks for trailing semicolons on conditionals



On Thu, 16 Aug 2007, Andy Whitcroft wrote:

> A couple of people suggested adding checks to checkpatch for trailing
> semicolons on conditionals, where the conditional block may not be
> actually conditional:
>
> if (err);
> return err;
>
> While regression testing the changes, I ran these checks across the
> whole of 2.6.23-rc3 and there appear to be 5 places where this is
> occurs (above and beyond the IPv6 one which triggered this effort)
> and a benign use which could be confused later which it seems safest
> to fix.
>
> Following this email are 6 patches for these issues, relevant
> maintainers cc'd. All against 2.6.23-rc3

Amazing :-) All 6 obviously correct, and one of those 5 bugs was around
for more than ~2 years! But most of these made one wonder (sadly) about
the (lack of) testing code got before getting merged, considering some
(#2 and 6, at least) should've been obvious immediately on basic testing
of the new feature, I think.

2007-08-16 16:21:11

by Paul Mundt

[permalink] [raw]
Subject: Re: drivers/infiniband/mlx/mad.c misplaced ;

On Wed, Aug 15, 2007 at 05:40:11PM -0700, Joe Perches wrote:
> $ egrep -r --include=*.c "\bif[[:space:]]*\([^\)]*\)[[:space:]]*\;" *
> arch/sh/boards/se/7343/io.c: if (0) ;
> drivers/atm/iphase.c: if (!desc1) ;
> drivers/infiniband/hw/mlx4/mad.c: if (!err);
> drivers/isdn/capi/capiutil.c: else if (c <= 0x0f);
> drivers/net/tokenring/ibmtr.c: else if (ti->shared_ram_paging == 0xf); /* No paging in adapter */
> drivers/s390/scsi/zfcp_erp.c: if (status == ZFCP_ERP_SUCCEEDED) ; /* no further action */
> fs/hostfs/hostfs_user.c: if(attrs->ia_valid & HOSTFS_ATTR_CTIME) ;
> net/netfilter/xt_u32.c: if (skb->len < 4 || pos > skb->len - 4);
> sound/pci/au88x0/au88x0_synth.c: if (eax == 0) ;

On Thu, Aug 16, 2007 at 02:18:40PM +0100, Andy Whitcroft wrote:
> A couple of people suggested adding checks to checkpatch for trailing
> semicolons on conditionals, where the conditional block may not be
> actually conditional:
>
> if (err);
> return err;
>
> While regression testing the changes, I ran these checks across the
> whole of 2.6.23-rc3 and there appear to be 5 places where this is
> occurs (above and beyond the IPv6 one which triggered this effort)
> and a benign use which could be confused later which it seems safest
> to fix.
>
> Following this email are 6 patches for these issues, relevant
> maintainers cc'd. All against 2.6.23-rc3
>
It looks like you may want to refine your search parameters to match the
above, as there are at least a few cases where the space exists.