Category: Linux

staging: android: ion: hisilicon: Remove useless return variables

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> This patch removes unnecessary return variables and compresses the return logic. The coccinelle script that finds and fixes this issue is: @@ type T; identifier i,f; constant C; @@ – T i; …when != i when strict ( return -C; | – i = + return f(…); – return i; ) …

Continue reading

staging: rdma: hfi1: Remove useless return variables

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> This patch removes unnecessary return variables and compresses the return logic. The coccinelle script that finds and fixes this issue is: @@ type T; identifier i,f; constant C; @@ – T i; …when != i when strict ( return -C; | – i = + return f(…); – return i; ) …

Continue reading

staging: rtl8712: Make return of 0 explicit

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Delete unnecessary local variable whose value is always 0 and return 0 as the result. The following Coccinelle script was used: @@ identifier ret; expression E; type T; @@ ( – T ret; | – T ret = 0; ) … when != \(ret=E \|ret–\|ret++\|–ret\|++ret\|ret-=E\|ret+=E\|ret|=E\|ret&=E\) ( ?-ret = 0; ) … …

Continue reading

staging: rts5208: Remove unnecessary pci_set_drvdata()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Unnecessary pci_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. The Coccinelle semantic patch used to make this change is as follows: // @@ struct …

Continue reading

staging: rdma: hfi1: Remove unnecessary pci_set_drvdata()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Unnecessary pci_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. The Coccinelle semantic patch used to make this change is as follows: // @@ struct …

Continue reading

staging: unisys: visorbus: Remove unnecessary dev_set_drvdata()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Unnecessary dev_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. The Coccinelle semantic patch used to make this change is as follows: // @@ struct …

Continue reading

staging: media: omap4iss: Remove unnecessary platform_set_drvdata()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Unnecessary platform_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. The Coccinelle semantic patch used to make this change is as follows: // @@ struct …

Continue reading

staging: sm750fb: Remove unnecessary pci_set_drvdata()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Unnecessary pci_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. The Coccinelle semantic patch used to make this change is as follows: // @@ struct …

Continue reading

staging: fbtft: Remove unnecessary spi_set_drvdata()

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Unnecessary spi_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. The Coccinelle semantic patch used to make this change is as follows: @@ struct spi_device …

Continue reading

staging: android: Replace min_t/max_t with min/max

Author: Amitoj Kaur Chawla <amitoj1606@gmail.com> Replace min_t/max_t with min/max when both variables are of the same type. The Coccinelle semantic patch used to make this change is as follows: @@ type T; T a,b; @@ – min_t(T, a, b) + min(a, b) @@ type T; T a,b; @@ – max_t(T, a, b) + max(a, b) …

Continue reading