Skip to content

Commit

Permalink
drivers/isdn/hardware/mISDN: move a dereference below a NULL test
Browse files Browse the repository at this point in the history
In each case, if the NULL test is necessary, then the dereference should be
moved below the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E
      when != i
  if (E == NULL) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Karsten Keil <kkeil@suse.de>
  • Loading branch information
Julia Lawall authored and Karsten Keil committed Jan 11, 2009
1 parent f27b8c3 commit 20b7880
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/isdn/hardware/mISDN/hfcmulti.c
Original file line number Diff line number Diff line change
Expand Up @@ -3615,14 +3615,15 @@ hfcm_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
static void
ph_state_change(struct dchannel *dch)
{
struct hfc_multi *hc = dch->hw;
struct hfc_multi *hc;
int ch, i;

if (!dch) {
printk(KERN_WARNING "%s: ERROR given dch is NULL\n",
__func__);
return;
}
hc = dch->hw;
ch = dch->slot;

if (hc->type == 1) {
Expand Down

0 comments on commit 20b7880

Please sign in to comment.