Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754003AbbDMLVp (ORCPT ); Mon, 13 Apr 2015 07:21:45 -0400 Received: from mail-vn0-f54.google.com ([209.85.216.54]:37484 "EHLO mail-vn0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbbDMLVl (ORCPT ); Mon, 13 Apr 2015 07:21:41 -0400 MIME-Version: 1.0 In-Reply-To: References: <1428830803-30896-1-git-send-email-peter.senna@gmail.com> Date: Mon, 13 Apr 2015 13:21:40 +0200 X-Google-Sender-Auth: FGO9M1bBfsbnK6-As8CVB_5K3M4 Message-ID: Subject: Re: [PATCH] Fix pointer cast for 32 bits arch From: Geert Uytterhoeven To: Peter Senna Tschudin Cc: Greg Kroah-Hartman , Loic Pefferkorn , Alan , Jun Tian , Octavian Purdila , Garret Kelly , =?UTF-8?Q?Kristina_Mart=C5=A1enko?= , Nick Kralevich , driverdevel , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1508 Lines: 49 Hi Peter, On Mon, Apr 13, 2015 at 1:14 PM, Peter Senna Tschudin wrote: >> Perhaps checkpatch should complain about casts outside header files? > Cocinelle found 664 double casts: > http://pastebin.com/2bi9Dg7k > > and 9 triple casts: > http://pastebin.com/RkJhPTTV I think double casts are only needed when casting between integers and pointers of different sizes: 1. One cast to make the sizes match, 2. One cast to convert between pointer and integer. I think triple casts can always be simplified. Or am I missing some use cases? > Those are 'not' patches, just the output of Coccinelle for analysis. > The .cocci for triple cast: > @@ > expression e1, e2; > type t1, t2, t3; > @@ > e1 = > - (t1)(t2)(t3) > e2 > > So if there are cast patterns known to be wrong, it is easy to find > and probably fix them with Coccinelle. It depends on the original type and on the destination type. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/