Skip to contentSkip to conversation

drm: refactor call to request_module

PATCH In review Kees Cook 2 participants 3 messages May 7, 2013 – May 8, 2013

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 drm: refactor call to request_module

This reduces the size of the stack frame when calling request_module(). Performing the sprintf before the call is not needed.

---
 drivers/gpu/drm/drm_encoder_slave.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/drm_encoder_slave.c +1 -5
index 48c52f7..0cfb60f 100644
@@ -54,16 +54,12 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 			 struct i2c_adapter *adap,
 			 const struct i2c_board_info *info)
 {
-	char modalias[sizeof(I2C_MODULE_PREFIX)
-		      + I2C_NAME_SIZE];
 	struct module *module = NULL;
 	struct i2c_client *client;
 	struct drm_i2c_encoder_driver *encoder_drv;
 	int err = 0;
 
-	snprintf(modalias, sizeof(modalias),
-		 "%s%s", I2C_MODULE_PREFIX, info->type);
-	request_module(modalias);
+	request_module("%s%s", I2C_MODULE_PREFIX, info->type);
 
 	client = i2c_new_device(adap, info);
 	if (!client) {
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
Acked-by on v1 1/1
#1 lore raw

Am Dienstag, den 07.05.2013, 12:32 -0700 schrieb Kees Cook:

Quoted 2 lines

This reduces the size of the stack frame when calling request_module(). Performing the sprintf before the call is not needed.

Good fine. Do you have any hard numbers for the record?

Did you find this just by reading the code or are there any problems with stack sizes on some systems?

(This patch would be good alone for decreasing the number of code lines. ;-))

Quoted 4 lines
---
 drivers/gpu/drm/drm_encoder_slave.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Thanks,

Paul

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

author
#2 lore raw
Quoted 11 lines · Paul Menzel

Am Dienstag, den 07.05.2013, 12:32 -0700 schrieb Kees Cook:

Quoted 2 lines

This reduces the size of the stack frame when calling request_module(). Performing the sprintf before the call is not needed.

Good fine. Do you have any hard numbers for the record?

Did you find this just by reading the code or are there any problems with stack sizes on some systems?

(This patch would be good alone for decreasing the number of code lines. ;-))

No hard numbers; I just saw it while reviewing callers to request_module(). :)

Quoted 6 lines
Quoted 4 lines
---
 drivers/gpu/drm/drm_encoder_slave.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Thanks!

-Kees

--
Kees Cook
Chrome OS Security