sound: oxygen: fix NULL pointer dereference when loading snd-oxygen
authorClemens Ladisch <clemens@ladisch.de>
Mon, 16 Jun 2008 12:13:52 +0000 (14:13 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 16 Jun 2008 13:16:11 +0000 (15:16 +0200)
Check that model->control_filter is set before trying to call it.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/oxygen/oxygen_mixer.c

index cc0cddadd589b259d0a4ff13334c70ce8f7e681f..6facac5aed90b3cddcb26bdf444098d84b5e09ad 100644 (file)
@@ -936,11 +936,13 @@ static int add_controls(struct oxygen *chip,
 
        for (i = 0; i < count; ++i) {
                template = controls[i];
-               err = chip->model->control_filter(&template);
-               if (err < 0)
-                       return err;
-               if (err == 1)
-                       continue;
+               if (chip->model->control_filter) {
+                       err = chip->model->control_filter(&template);
+                       if (err < 0)
+                               return err;
+                       if (err == 1)
+                               continue;
+               }
                if (!strcmp(template.name, "Master Playback Volume") &&
                    chip->model->dac_tlv) {
                        template.tlv.p = chip->model->dac_tlv;