Skip to contentSkip to conversation

pt3: remove bogus module_is_live() check

PATCH In review Arnd Bergmann 2 participants 2 messages Sep 29, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pt3: remove bogus module_is_live() check

The new pt3 driver checks the module reference for presence before dropping it, which fails to compile when modules are disabled:

media/pci/pt3/pt3.c: In function 'pt3_attach_fe':
media/pci/pt3/pt3.c:433:6: error: implicit declaration of function 'module_is_live' [-Werror=implicit-function-declaration]

      module_is_live(pt3->adaps[i]->i2c_tuner->dev.driver->owner))

As far as I can tell however, this check is not needed at all, because the module will not go away as long as pt3 is holding a reference on it. Also the previous check for NULL pointer is not needed at all, because module_put has the same check.

drivers/media/pci/pt3/pt3.c +2 -6
index 90f86ce7a001..39305f07dc2e 100644
@@ -429,14 +429,10 @@ static int pt3_attach_fe(struct pt3_board *pt3, int i)
 
 err_tuner:
 	i2c_unregister_device(pt3->adaps[i]->i2c_tuner);
-	if (pt3->adaps[i]->i2c_tuner->dev.driver->owner &&
-	    module_is_live(pt3->adaps[i]->i2c_tuner->dev.driver->owner))
-		module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
+	module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
 err_demod:
 	i2c_unregister_device(pt3->adaps[i]->i2c_demod);
-	if (pt3->adaps[i]->i2c_demod->dev.driver->owner &&
-	    module_is_live(pt3->adaps[i]->i2c_demod->dev.driver->owner))
-		module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
+	module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
 	return ret;
 }
 
#1 lore raw

Hi Arnd,

Em Mon, 29 Sep 2014 16:28:55 +0200
Arnd Bergmann <[email protected]> escreveu:

Quoted 6 lines

The new pt3 driver checks the module reference for presence before dropping it, which fails to compile when modules are disabled:

media/pci/pt3/pt3.c: In function 'pt3_attach_fe':
media/pci/pt3/pt3.c:433:6: error: implicit declaration of function 'module_is_live' [-Werror=implicit-function-declaration]

Quoted 8 lines
      module_is_live(pt3->adaps[i]->i2c_tuner->dev.driver->owner))

As far as I can tell however, this check is not needed at all, because the module will not go away as long as pt3 is holding a reference on it. Also the previous check for NULL pointer is not needed at all, because module_put has the same check.

Thanks for this patch. Antti was quicker than you ;)

I merged the patch on my tree yesterday. It should be popping up on the tomorrow's -next (I think that sfr didn't release one today).

Quoted 23 lines
drivers/media/pci/pt3/pt3.c +2 -6
index 90f86ce7a001..39305f07dc2e 100644
@@ -429,14 +429,10 @@ static int pt3_attach_fe(struct pt3_board *pt3, int i)
 
 err_tuner:
 	i2c_unregister_device(pt3->adaps[i]->i2c_tuner);
-	if (pt3->adaps[i]->i2c_tuner->dev.driver->owner &&
-	    module_is_live(pt3->adaps[i]->i2c_tuner->dev.driver->owner))
-		module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
+	module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
 err_demod:
 	i2c_unregister_device(pt3->adaps[i]->i2c_demod);
-	if (pt3->adaps[i]->i2c_demod->dev.driver->owner &&
-	    module_is_live(pt3->adaps[i]->i2c_demod->dev.driver->owner))
-		module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
+	module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
 	return ret;
 }