Commit c424d46f authored by Alexander Beregalov's avatar Alexander Beregalov Committed by Greg Kroah-Hartman

staging: cx25821: avoid NULL pointer dereference

Assign dev only if fh is not NULL.
Signed-off-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 267c39c9
...@@ -343,10 +343,11 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -343,10 +343,11 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl) struct v4l2_control *ctl)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev;
int err; int err;
if (fh) { if (fh) {
dev = fh->dev;
err = v4l2_prio_check(&dev->prio, &fh->prio); err = v4l2_prio_check(&dev->prio, &fh->prio);
if (0 != err) if (0 != err)
return err; return err;
......
...@@ -963,10 +963,11 @@ int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f) ...@@ -963,10 +963,11 @@ int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f)
int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev;
int err; int err;
if (fh) { if (fh) {
dev = fh->dev;
err = v4l2_prio_check(&dev->prio, &fh->prio); err = v4l2_prio_check(&dev->prio, &fh->prio);
if (0 != err) if (0 != err)
return err; return err;
......
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