aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/ti-st/st_core.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 1972d57aadb3..54be83d3efdd 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -153,8 +153,9 @@ static void st_reg_complete(struct st_data_s *st_gdata, char err)
153 (st_gdata->list[i]->priv_data, err); 153 (st_gdata->list[i]->priv_data, err);
154 pr_info("protocol %d's cb sent %d\n", i, err); 154 pr_info("protocol %d's cb sent %d\n", i, err);
155 if (err) { /* cleanup registered protocol */ 155 if (err) { /* cleanup registered protocol */
156 st_gdata->protos_registered--;
157 st_gdata->is_registered[i] = false; 156 st_gdata->is_registered[i] = false;
157 if (st_gdata->protos_registered)
158 st_gdata->protos_registered--;
158 } 159 }
159 } 160 }
160 } 161 }
@@ -639,14 +640,12 @@ long st_unregister(struct st_proto_s *proto)
639 return -EPROTONOSUPPORT; 640 return -EPROTONOSUPPORT;
640 } 641 }
641 642
642 st_gdata->protos_registered--; 643 if (st_gdata->protos_registered)
644 st_gdata->protos_registered--;
645
643 remove_channel_from_table(st_gdata, proto); 646 remove_channel_from_table(st_gdata, proto);
644 spin_unlock_irqrestore(&st_gdata->lock, flags); 647 spin_unlock_irqrestore(&st_gdata->lock, flags);
645 648
646 /* paranoid check */
647 if (st_gdata->protos_registered < ST_EMPTY)
648 st_gdata->protos_registered = ST_EMPTY;
649
650 if ((st_gdata->protos_registered == ST_EMPTY) && 649 if ((st_gdata->protos_registered == ST_EMPTY) &&
651 (!test_bit(ST_REG_PENDING, &st_gdata->st_state))) { 650 (!test_bit(ST_REG_PENDING, &st_gdata->st_state))) {
652 pr_info(" all chnl_ids unregistered "); 651 pr_info(" all chnl_ids unregistered ");