Commit cae0cf65 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usx2y: Don't call free_pages_exact() with NULL address

Unlike some other functions, we can't pass NULL pointer to
free_pages_exact().  Add a proper NULL check for avoiding possible
Oops.

Link: https://lore.kernel.org/r/20210517131545.27252-10-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 64a06f19
...@@ -143,8 +143,11 @@ void usb_stream_free(struct usb_stream_kernel *sk) ...@@ -143,8 +143,11 @@ void usb_stream_free(struct usb_stream_kernel *sk)
if (!s) if (!s)
return; return;
if (sk->write_page) {
free_pages_exact(sk->write_page, s->write_size); free_pages_exact(sk->write_page, s->write_size);
sk->write_page = NULL; sk->write_page = NULL;
}
free_pages_exact(s, s->read_size); free_pages_exact(s, s->read_size);
sk->s = NULL; sk->s = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment