From patchwork Tue Oct 26 12:20:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 69239 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4E3C6B70AF for ; Tue, 26 Oct 2010 23:21:32 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933067Ab0JZMVA (ORCPT ); Tue, 26 Oct 2010 08:21:00 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:36608 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932478Ab0JZMU7 (ORCPT ); Tue, 26 Oct 2010 08:20:59 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 6D4F34DC0E8; Tue, 26 Oct 2010 14:20:58 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03498-20; Tue, 26 Oct 2010 14:20:57 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 10E2E19BCD5; Tue, 26 Oct 2010 14:20:57 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 5BFA26DF835; Tue, 26 Oct 2010 14:17:39 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id E63732085A; Tue, 26 Oct 2010 14:20:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id DAB8220159; Tue, 26 Oct 2010 14:20:56 +0200 (CEST) Date: Tue, 26 Oct 2010 14:20:56 +0200 (CEST) From: Julia Lawall To: walter harms Cc: Karsten Keil , kernel-janitors@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 10/14] drivers/isdn: delete double assignment In-Reply-To: <4CC6C1C0.8020005@bfs.de> Message-ID: References: <1288088743-3725-1-git-send-email-julia@diku.dk> <1288088743-3725-11-git-send-email-julia@diku.dk> <4CC6C1C0.8020005@bfs.de> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Julia Lawall Delete successive assignments to the same location. In the first case, the hscx array has two elements, so change the assignment to initialize the second one. In the second case, the two assignments are simply identical. Furthermore, neither is necessary, because the effect of the assignment is only visible in the next line, in the assignment in the if test. The patch inlines the right hand side value in the latter assignment and pulls that assignment out of the if test. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = ...; i = ...; // Signed-off-by: Julia Lawall --- In the first case, the patch changes the semantics and has not been tested. drivers/isdn/hardware/mISDN/mISDNinfineon.c | 2 +- drivers/isdn/hisax/l3_1tr6.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn/hardware/mISDN/mISDNinfineon.c index af25e1f..e90db88 100644 --- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c +++ b/drivers/isdn/hardware/mISDN/mISDNinfineon.c @@ -563,7 +563,7 @@ reset_inf(struct inf_hw *hw) mdelay(10); hw->ipac.isac.adf2 = 0x87; hw->ipac.hscx[0].slot = 0x1f; - hw->ipac.hscx[0].slot = 0x23; + hw->ipac.hscx[1].slot = 0x23; break; case INF_GAZEL_R753: val = inl((u32)hw->cfg.start + GAZEL_CNTRL); diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c index b0554f8..ee4dae1 100644 --- a/drivers/isdn/hisax/l3_1tr6.c +++ b/drivers/isdn/hisax/l3_1tr6.c @@ -164,11 +164,9 @@ l3_1tr6_setup(struct l3_process *pc, u_char pr, void *arg) char tmp[80]; struct sk_buff *skb = arg; - p = skb->data; - /* Channel Identification */ - p = skb->data; - if ((p = findie(p, skb->len, WE0_chanID, 0))) { + p = findie(skb->data, skb->len, WE0_chanID, 0); + if (p) { if (p[1] != 1) { l3_1tr6_error(pc, "setup wrong chanID len", skb); return;