diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-03-26 15:18:36 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2018-04-04 11:36:20 +0200 |
commit | 2e81ae396788c7f1af327510899f06f773fe3501 (patch) | |
tree | 45bda80a6731db5c387083b2443ec8c8b9c2ffbd /drivers/media | |
parent | Merge branch 'userns-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/... (diff) | |
download | linux-2e81ae396788c7f1af327510899f06f773fe3501.tar.xz linux-2e81ae396788c7f1af327510899f06f773fe3501.zip |
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: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/tuners/r820t.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index bc9299059f48..3e14b9e2e763 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -20,6 +20,8 @@ // // RF Gain set/get is not implemented. +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/videodev2.h> #include <linux/mutex.h> #include <linux/slab.h> @@ -2371,7 +2373,7 @@ err: err_no_gate: mutex_unlock(&r820t_list_mutex); - tuner_info("%s: failed=%d\n", __func__, rc); + pr_info("%s: failed=%d\n", __func__, rc); r820t_release(fe); return NULL; } |