Commit bbc62a18 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] au0828: fix checks if dvb is initialized

dev->dvb is always not null, as it is an area at the dev
memory. So, checking if (dev->dvb) is always true.

Instead of this stupid check, what the code wants to do is
to know if the DVB was successully registered.

Fix it by checking, instead, for dvb->frontend. It should
also be sure that this var will be NULL if the device was
not properly initialized.
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 59b94f3e
...@@ -267,7 +267,7 @@ static int au0828_dvb_start_feed(struct dvb_demux_feed *feed) ...@@ -267,7 +267,7 @@ static int au0828_dvb_start_feed(struct dvb_demux_feed *feed)
if (!demux->dmx.frontend) if (!demux->dmx.frontend)
return -EINVAL; return -EINVAL;
if (dvb) { if (dvb->frontend) {
mutex_lock(&dvb->lock); mutex_lock(&dvb->lock);
dvb->start_count++; dvb->start_count++;
dprintk(1, "%s(), start_count: %d, stop_count: %d\n", __func__, dprintk(1, "%s(), start_count: %d, stop_count: %d\n", __func__,
...@@ -296,7 +296,7 @@ static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed) ...@@ -296,7 +296,7 @@ static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed)
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
if (dvb) { if (dvb->frontend) {
cancel_work_sync(&dev->restart_streaming); cancel_work_sync(&dev->restart_streaming);
mutex_lock(&dvb->lock); mutex_lock(&dvb->lock);
...@@ -526,8 +526,7 @@ void au0828_dvb_unregister(struct au0828_dev *dev) ...@@ -526,8 +526,7 @@ void au0828_dvb_unregister(struct au0828_dev *dev)
for (i = 0; i < URB_COUNT; i++) for (i = 0; i < URB_COUNT; i++)
kfree(dev->dig_transfer_buffer[i]); kfree(dev->dig_transfer_buffer[i]);
} }
dvb->frontend = NULL;
} }
/* All the DVB attach calls go here, this function get's modified /* All the DVB attach calls go here, this function get's modified
...@@ -608,6 +607,7 @@ int au0828_dvb_register(struct au0828_dev *dev) ...@@ -608,6 +607,7 @@ int au0828_dvb_register(struct au0828_dev *dev)
if (ret < 0) { if (ret < 0) {
if (dvb->frontend->ops.release) if (dvb->frontend->ops.release)
dvb->frontend->ops.release(dvb->frontend); dvb->frontend->ops.release(dvb->frontend);
dvb->frontend = NULL;
return ret; return ret;
} }
...@@ -618,7 +618,7 @@ void au0828_dvb_suspend(struct au0828_dev *dev) ...@@ -618,7 +618,7 @@ void au0828_dvb_suspend(struct au0828_dev *dev)
{ {
struct au0828_dvb *dvb = &dev->dvb; struct au0828_dvb *dvb = &dev->dvb;
if (dvb && dev->urb_streaming) { if (dvb->frontend && dev->urb_streaming) {
pr_info("stopping DVB\n"); pr_info("stopping DVB\n");
cancel_work_sync(&dev->restart_streaming); cancel_work_sync(&dev->restart_streaming);
...@@ -635,7 +635,7 @@ void au0828_dvb_resume(struct au0828_dev *dev) ...@@ -635,7 +635,7 @@ void au0828_dvb_resume(struct au0828_dev *dev)
{ {
struct au0828_dvb *dvb = &dev->dvb; struct au0828_dvb *dvb = &dev->dvb;
if (dvb && dev->urb_streaming) { if (dvb->frontend && dev->urb_streaming) {
pr_info("resuming DVB\n"); pr_info("resuming DVB\n");
au0828_set_frontend(dvb->frontend); au0828_set_frontend(dvb->frontend);
......
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