Skip to content

Commit

Permalink
staging/slicoss: Check pointer before dereferencing
Browse files Browse the repository at this point in the history
Smatch complains that the variable adapter is dereferenced before it is
checked:
slicoss.c:906 slic_timer_load_check() warn: variable dereferenced before
check 'adapter' (see line 904)

-> move the assignment after the check.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Huewe authored and Greg Kroah-Hartman committed Mar 11, 2013
1 parent 4fcf949 commit 8137211
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/slicoss/slicoss.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,9 @@ static void slic_timer_load_check(ulong cardaddr)
u32 load = card->events;
u32 level = 0;

intagg = &adapter->slic_regs->slic_intagg;

if ((adapter) && (adapter->state == ADAPT_UP) &&
(card->state == CARD_UP) && (slic_global.dynamic_intagg)) {
intagg = &adapter->slic_regs->slic_intagg;
if (adapter->devid == SLIC_1GB_DEVICE_ID) {
if (adapter->linkspeed == LINK_1000MB)
level = 100;
Expand Down

0 comments on commit 8137211

Please sign in to comment.