Skip to content

Commit

Permalink
ALSA: emu10k1: Fix possible NULL dereference
Browse files Browse the repository at this point in the history
The previous dev_err() conversion resulted in a code that may give
NULL dereference in snd_emu10k1_ptr_write().  Since it's a sanity
check, better to be replaced with a debug macro like other places in
this driver.

Fixes: 6f002b0 ('ALSA: emu10k1: Use standard printk helpers')
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Mar 5, 2014
1 parent 4f50b41 commit 4913cd6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sound/pci/emu10k1/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned i
unsigned long flags;
unsigned int mask;

if (!emu) {
dev_err(emu->card->dev, "ptr_write: emu is null!\n");
dump_stack();
if (snd_BUG_ON(!emu))
return;
}
mask = emu->audigy ? A_PTR_ADDRESS_MASK : PTR_ADDRESS_MASK;
regptr = ((reg << 16) & mask) | (chn & PTR_CHANNELNUM_MASK);

Expand Down

0 comments on commit 4913cd6

Please sign in to comment.