diff mbox

[2/4] staging: media: go7007: firmware protection Protection for unfirmware load

Message ID 1358341251-10087-2-git-send-email-volokh84@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Volokh Konstantin Jan. 16, 2013, 1 p.m. UTC
Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
---
 drivers/staging/media/go7007/go7007-usb.c  |    2 +-
 drivers/staging/media/go7007/go7007-v4l2.c |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Dan Carpenter Jan. 16, 2013, 1:35 p.m. UTC | #1
The problem is that the firmware was being unloaded on disconnect?

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Volokh Konstantin Jan. 16, 2013, 1:42 p.m. UTC | #2
On Wed, Jan 16, 2013 at 04:35:45PM +0300, Dan Carpenter wrote:
> The problem is that the firmware was being unloaded on disconnect?
> 
> regards,
> dan carpenter
If no firmware was loaded (no exists,wrong or some error) then rmmod fails with OOPS,
so need some protection stuff
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ezequiel Garcia Jan. 16, 2013, 6:03 p.m. UTC | #3
Hi Volokh,

On Wed, Jan 16, 2013 at 10:42 AM, Volokh Konstantin <volokh84@gmail.com> wrote:
> On Wed, Jan 16, 2013 at 04:35:45PM +0300, Dan Carpenter wrote:
>> The problem is that the firmware was being unloaded on disconnect?
>>
> If no firmware was loaded (no exists,wrong or some error) then rmmod fails with OOPS,
> so need some protection stuff

This explanation should be part of the commit message.
It helps people understand what you're doing and why it's needed.

BTW, none of this 4-patch series has a detailed commit message
besides the commit title.
I know they are small patches, but I'm sure you can do better than that!
diff mbox

Patch

diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c
index 5443e25..a6cad15 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1245,7 +1245,6 @@  static void go7007_usb_disconnect(struct usb_interface *intf)
 	struct urb *vurb, *aurb;
 	int i;
 
-	go->status = STATUS_SHUTDOWN;
 	usb_kill_urb(usb->intr_urb);
 
 	/* Free USB-related structs */
@@ -1269,6 +1268,7 @@  static void go7007_usb_disconnect(struct usb_interface *intf)
 	kfree(go->hpi_context);
 
 	go7007_remove(go);
+	go->status = STATUS_SHUTDOWN;
 }
 
 static struct usb_driver go7007_usb_driver = {
diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c
index e6fa543..a69250f 100644
--- a/drivers/staging/media/go7007/go7007-v4l2.c
+++ b/drivers/staging/media/go7007/go7007-v4l2.c
@@ -1832,5 +1832,6 @@  void go7007_v4l2_remove(struct go7007 *go)
 	mutex_unlock(&go->hw_lock);
 	if (go->video_dev)
 		video_unregister_device(go->video_dev);
-	v4l2_device_unregister(&go->v4l2_dev);
+	if (go->status != STATUS_SHUTDOWN)
+		v4l2_device_unregister(&go->v4l2_dev);
 }