Coccinellery – Part 2

As a continuation to my last post, I will continuetalking about the interesting scripts in Coccinellery.

simplify_ioremap_resource.cocci is a script that detects case where there is error handling for a platform_get_resource call just before a call to devm_ioremap_resource. This error handling is not required and should be removed. Thisthis and this are example patches that have been added to the kernel already.

simple_kzalloc.cocci finds cases where kmalloc and memset 0 are used since they can be replaced by a direct call to kzalloc. After using this script Julia suggested finding more functions like these where memset and the function call can be replaced by a direct function call. For example: vmalloc/vzalloc is a similar case and a patch accepted for this case.

kmemdup.cocci is used to find cases where memory is allocated followed by a call to memcpy. These two calls can be replaced by a direct call to kmemdup. This is an example patch.

moduleparam.cocci is a script to find cases where both module.h and moduleparam.h are included. module.h contains a call to moduleparam.h making the call to it redundant and useless. These are some accepted patches for the same: one and two.

export_static.cocci finds cases where a static function is being exported which is not possible. Sadly could not find any cases to submit patches on.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s