Commit 2e81ae39 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: r820t: don't crash if attach fails

As pointed by smatch:
	drivers/media/tuners/r820t.c:2374 r820t_attach() error: potential null dereference 'priv'.  (kzalloc returns null)

The current function with prints error assumes that the attach
succeeds. So, don't use it in case of failures.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 17dec0a9
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
// //
// RF Gain set/get is not implemented. // RF Gain set/get is not implemented.
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -2371,7 +2373,7 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe, ...@@ -2371,7 +2373,7 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe,
err_no_gate: err_no_gate:
mutex_unlock(&r820t_list_mutex); mutex_unlock(&r820t_list_mutex);
tuner_info("%s: failed=%d\n", __func__, rc); pr_info("%s: failed=%d\n", __func__, rc);
r820t_release(fe); r820t_release(fe);
return NULL; return 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