Task 2: checkpath.pl documentation mentorship: remove semicolon warnings.
Subsystems (10)
PATCH 2/2 Task 2: checkpath.pl documentation mentorship: remove semicolon warnings.
i changed the lines such that they no longer evoke the (ONE_SEMICOLON) warning where possible.
there were 7 files with true positive violation.
drivers/mtd/ubi/block.c:408: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
drivers/gpu/drm/nouveau/nouveau_gem.c:342: WARNING:ONE_SEMICOLON:
Statements terminations use 1 semicolon
fs/block_dev.c:1269: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
(for fs/block_dev.c, the error was actually on line 1271 for me, not on 1269)
include/trace/events/iocost.h:163: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
net/sched/cls_rsvp.h:231: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
net/sched/cls_u32.c:782: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
drivers/net/ethernet/mediatek/mtk_star_emac.c:1089:
WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
the rest of the files given below i think are false positives, as they repeatedly use ";;" in their code. so i guess it is necessary in their case.
arch/ia64/include/asm/mca_asm.h:139: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/include/asm/mca_asm.h:213: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/include/asm/native/inst.h:79: WARNING:ONE_SEMICOLON:
Statements terminations use 1 semicolon
arch/ia64/kernel/minstate.h:14: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/kernel/minstate.h:151: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/kernel/minstate.h:213: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
--- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- drivers/net/ethernet/mediatek/mtk_star_emac.c | 2 +- fs/block_dev.c | 2 +- include/trace/events/iocost.h | 2 +- net/sched/cls_rsvp.h | 2 +- net/sched/cls_u32.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +1 -1
@@ -339,7 +339,7 @@ nouveau_gem_set_domain(struct drm_gem_object *gem, uint32_t read_domains,struct ttm_buffer_object *bo = &nvbo->bo;uint32_t domains = valid_domains & nvbo->valid_domains & (write_domains ? write_domains : read_domains); -uint32_t pref_domains =0 ;; +uint32_t pref_domains =0 ;if (!domains)return -EINVAL ;
drivers/net/ethernet/mediatek/mtk_star_emac.c +1 -1
@@ -1086,7 +1086,7 @@ static void mtk_star_tx_complete_all(struct mtk_star_priv *priv)spin_lock (&priv->lock); -for (pkts_compl =0 , bytes_compl =0 ;; +for (pkts_compl =0 , bytes_compl =0 ; pkts_compl++, bytes_compl += ret, wake = true) {if (!mtk_star_ring_descs_available (ring))break ;
fs/block_dev.c +1 -1
@@ -1268,7 +1268,7 @@ static int blkdev_get_whole(struct block_device *bdev, fmode_t mode)if (test_bit (GD_NEED_PART_SCAN , &disk->state))bdev_disk_changed (disk, false); bdev->bd_openers++; -return 0 ;; +return 0 ; }static void blkdev_put_whole (struct block_device *bdev,fmode_t mode)
include/trace/events/iocost.h +1 -1
@@ -160,7 +160,7 @@ TRACE_EVENT(iocost_ioc_vrate_adj,TP_fast_assign ( __assign_str(devname, ioc_name(ioc)); - __entry->old_vrate =atomic64_read (&ioc->vtime_rate);; + __entry->old_vrate =atomic64_read (&ioc->vtime_rate); __entry->new_vrate = new_vrate; __entry->busy_level = ioc->busy_level; __entry->read_missed_ppm = missed_ppm[READ ];
net/sched/cls_rsvp.h +1 -1
@@ -228,7 +228,7 @@ static void rsvp_replace(struct tcf_proto *tp, struct rsvp_filter *n, u32 h)for (s =rtnl_dereference (head->ht[h1]); s; s =rtnl_dereference (s->next)) { -for (ins = &s->ht[h2], pins =rtnl_dereference (*ins); ; +for (ins = &s->ht[h2], pins =rtnl_dereference (*ins); ins = &pins->next, pins = rtnl_dereference(*ins)) {if (pins->handle == h) {RCU_INIT_POINTER (n->next, pins->next);
net/sched/cls_u32.c +1 -1
@@ -779,7 +779,7 @@ static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c,/* The node must always exist for it to be replaced if this is not the * case then something went very wrong elsewhere. */ -for (pins =rtnl_dereference (*ins); ; +for (pins =rtnl_dereference (*ins); ins = &pins->next, pins = rtnl_dereference(*ins))if (pins->handle == n->handle)break ;
Signature · 6 lines
2.25.1 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 23 lines · Rahul Balaji
i changed the lines such that they no longer evoke the (
ONE_SEMICOLON) warning where possible.there were 7 files with true positive violation.
drivers/mtd/ubi/block.c:408: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
drivers/gpu/drm/nouveau/nouveau_gem.c:342: WARNING:ONE_SEMICOLON:
Statements terminations use 1 semicolon
fs/block_dev.c:1269: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon(for
fs/block_dev.c, the error was actually on line 1271 for me, not on 1269)
include/trace/events/iocost.h:163: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
net/sched/cls_rsvp.h:231: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
Quoted 8 lines
net/sched/cls_u32.c:782: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
drivers/net/ethernet/mediatek/mtk_star_emac.c:1089:
WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolonthe rest of the files given below i think are false positives, as they repeatedly use ";;" in their code. so i guess it is necessary in their case.
Can you explain your guess? Why should the number of occurrences in one file be an indicator for a true positive or false positive?
Quoted 45 lines
arch/ia64/include/asm/mca_asm.h:139: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/include/asm/mca_asm.h:213: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/include/asm/native/inst.h:79: WARNING:ONE_SEMICOLON:
Statements terminations use 1 semicolon
arch/ia64/kernel/minstate.h:14: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/kernel/minstate.h:151: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon
arch/ia64/kernel/minstate.h:213: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon--- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- drivers/net/ethernet/mediatek/mtk_star_emac.c | 2 +- fs/block_dev.c | 2 +- include/trace/events/iocost.h | 2 +- net/sched/cls_rsvp.h | 2 +- net/sched/cls_u32.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/nouveau/nouveau_gem.c +1
-1@@ -339,7 +339,7 @@ nouveau_gem_set_domain(struct drm_gem_object *gem, uint32_t read_domains,struct ttm_buffer_object *bo = &nvbo->bo;uint32_t domains = valid_domains & nvbo->valid_domains & (write_domains ? write_domains : read_domains); -uint32_t pref_domains =0 ;; +uint32_t pref_domains =0 ;if (!domains)return -EINVAL ;drivers/net/ethernet/mediatek/mtk_star_emac.c +0
-0
drivers/net/ethernet/mediatek/mtk_star_emac.c static void mtk_star_tx_complete_all(struct mtk_star_priv *priv) · line 1090
Quoted 6 lines
drivers/net/ethernet/mediatek/mtk_star_emac.c +1
-1@@ -1086,7 +1086,7 @@ static void mtk_star_tx_complete_all(struct mtk_star_priv *priv)spin_lock (&priv->lock); -for (pkts_compl =0 , bytes_compl =0 ;; +for (pkts_compl =0 , bytes_compl =0 ; pkts_compl++, bytes_compl += ret, wake = true) {
Was this driver buggy?
Do you intend to modify the behavior of this driver?
Are you sure that your change does not modify the behaviour of this driver? Is it a purely syntactic change here? Does it even compile after your change?
Quoted 33 lines
drivers/net/ethernet/mediatek/mtk_star_emac.c +0
-0if (!mtk_star_ring_descs_available (ring))break ;fs/block_dev.c +1
-1@@ -1268,7 +1268,7 @@ static int blkdev_get_whole(struct block_device *bdev, fmode_t mode)if (test_bit (GD_NEED_PART_SCAN , &disk->state))bdev_disk_changed (disk, false); bdev->bd_openers++; -return 0 ;; +return 0 ; }static void blkdev_put_whole (struct block_device *bdev,fmode_t mode)include/trace/events/iocost.h +1
-1@@ -160,7 +160,7 @@ TRACE_EVENT(iocost_ioc_vrate_adj,TP_fast_assign ( __assign_str(devname, ioc_name(ioc)); - __entry->old_vrate =atomic64_read (&ioc->vtime_rate);; + __entry->old_vrate =atomic64_read (&ioc->vtime_rate); __entry->new_vrate = new_vrate; __entry->busy_level = ioc->busy_level; __entry->read_missed_ppm = missed_ppm[READ ];net/sched/cls_rsvp.h +0
-0
net/sched/cls_rsvp.h static void rsvp_replace(struct tcf_proto *tp, struct rsvp_filter *n, u32 h) · line 231
Quoted 5 lines
net/sched/cls_rsvp.h +1
-1@@ -228,7 +228,7 @@ static void rsvp_replace(struct tcf_proto *tp, struct rsvp_filter *n, u32 h)for (s =rtnl_dereference (head->ht[h1]); s; s =rtnl_dereference (s->next)) { - for (ins = &s->ht[h2], pins = rtnl_dereference(*ins); ; + for (ins = &s->ht[h2], pins = rtnl_dereference(*ins);
Again:
Was this code buggy?
Do you intend to modify the behavior of this code?
Are you sure that your change does not modify the behaviour of this code? Is it a purely syntactic change here? Does it even compile after your change?
Quoted 8 lines
net/sched/cls_rsvp.h +0
-0ins = &pins->next, pins = rtnl_dereference(*ins)) {if (pins->handle == h) {RCU_INIT_POINTER (n->next, pins->next);net/sched/cls_u32.c +0
-0
net/sched/cls_u32.c static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c, · line 783
Quoted 6 lines
net/sched/cls_u32.c +1
-1@@ -779,7 +779,7 @@ static void u32_replace_knode(struct tcf_proto *tp, struct tc_u_common *tp_c,/* The node must always exist for it to be replaced if this is not the * case then something went very wrong elsewhere. */ -for (pins =rtnl_dereference (*ins); ; +for (pins =rtnl_dereference (*ins); ins = &pins->next, pins = rtnl_dereference(*ins))
Again:
Was this code buggy?
Do you intend to modify the behavior of this code?
Are you sure that your change does not modify the behaviour of this code? Is it a purely syntactic change here? Does it even compile after your change?
Quoted 5 lines
net/sched/cls_u32.c +0
-1if (pins->handle == n->handle)break ; --2.25.1
Overall: please think more critically about what code you are modifying and why. Just that checkpatch mentions some pattern, does not mean that the change is always reasonable (Think for yourself!). Maybe, you can think about a change to the rule so that a certain pattern is not indicated anymore... and after some discussion, show that you can IMPLEMENT such change to checkpatch. You want to contribute improvements to checkpatch and WE WANT you to contribute as well.
Lukas
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees