aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-09-12 06:58:16 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-09-12 09:04:18 -0400
commit0bdfe0cb803dce699ff337c35d8e97ac355fa417 (patch)
treee8bb0809732d48f85c7eb44d15fed0ff36cf8f30 /drivers
parent6d8451d55a2a9467bc9647aafe8b6faee0251687 (diff)
i2c: omap: sanitize exit path
move the goto out label one line down, so that it can be used when stat is read as zero. All other exits, can be done with a break statement. While at that, also break out as soon as we complete draining IRQ, since at that time we know we transferred everything there was to be transferred. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-omap.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 122f517c5bcb..b149e3236da4 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -901,27 +901,26 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
901 901
902 if (!stat) { 902 if (!stat) {
903 /* my work here is done */ 903 /* my work here is done */
904 spin_unlock_irqrestore(&dev->lock, flags); 904 goto out;
905 return IRQ_HANDLED;
906 } 905 }
907 906
908 dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat); 907 dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat);
909 if (count++ == 100) { 908 if (count++ == 100) {
910 dev_warn(dev->dev, "Too much work in one IRQ\n"); 909 dev_warn(dev->dev, "Too much work in one IRQ\n");
911 goto out; 910 break;
912 } 911 }
913 912
914 if (stat & OMAP_I2C_STAT_NACK) { 913 if (stat & OMAP_I2C_STAT_NACK) {
915 err |= OMAP_I2C_STAT_NACK; 914 err |= OMAP_I2C_STAT_NACK;
916 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); 915 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK);
917 goto out; 916 break;
918 } 917 }
919 918
920 if (stat & OMAP_I2C_STAT_AL) { 919 if (stat & OMAP_I2C_STAT_AL) {
921 dev_err(dev->dev, "Arbitration lost\n"); 920 dev_err(dev->dev, "Arbitration lost\n");
922 err |= OMAP_I2C_STAT_AL; 921 err |= OMAP_I2C_STAT_AL;
923 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL); 922 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL);
924 goto out; 923 break;
925 } 924 }
926 925
927 /* 926 /*
@@ -934,7 +933,7 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
934 OMAP_I2C_STAT_XRDY | 933 OMAP_I2C_STAT_XRDY |
935 OMAP_I2C_STAT_XDR | 934 OMAP_I2C_STAT_XDR |
936 OMAP_I2C_STAT_ARDY)); 935 OMAP_I2C_STAT_ARDY));
937 goto out; 936 break;
938 } 937 }
939 938
940 if (stat & OMAP_I2C_STAT_RDR) { 939 if (stat & OMAP_I2C_STAT_RDR) {
@@ -949,7 +948,7 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
949 i2c_omap_errata_i207(dev, stat); 948 i2c_omap_errata_i207(dev, stat);
950 949
951 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); 950 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR);
952 continue; 951 break;
953 } 952 }
954 953
955 if (stat & OMAP_I2C_STAT_RRDY) { 954 if (stat & OMAP_I2C_STAT_RRDY) {
@@ -972,10 +971,10 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
972 971
973 ret = omap_i2c_transmit_data(dev, num_bytes, true); 972 ret = omap_i2c_transmit_data(dev, num_bytes, true);
974 if (ret < 0) 973 if (ret < 0)
975 goto out; 974 break;
976 975
977 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XDR); 976 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XDR);
978 continue; 977 break;
979 } 978 }
980 979
981 if (stat & OMAP_I2C_STAT_XRDY) { 980 if (stat & OMAP_I2C_STAT_XRDY) {
@@ -987,7 +986,7 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
987 986
988 ret = omap_i2c_transmit_data(dev, num_bytes, false); 987 ret = omap_i2c_transmit_data(dev, num_bytes, false);
989 if (ret < 0) 988 if (ret < 0)
990 goto out; 989 break;
991 990
992 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY); 991 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY);
993 continue; 992 continue;
@@ -997,19 +996,20 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
997 dev_err(dev->dev, "Receive overrun\n"); 996 dev_err(dev->dev, "Receive overrun\n");
998 err |= OMAP_I2C_STAT_ROVR; 997 err |= OMAP_I2C_STAT_ROVR;
999 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_ROVR); 998 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_ROVR);
1000 goto out; 999 break;
1001 } 1000 }
1002 1001
1003 if (stat & OMAP_I2C_STAT_XUDF) { 1002 if (stat & OMAP_I2C_STAT_XUDF) {
1004 dev_err(dev->dev, "Transmit underflow\n"); 1003 dev_err(dev->dev, "Transmit underflow\n");
1005 err |= OMAP_I2C_STAT_XUDF; 1004 err |= OMAP_I2C_STAT_XUDF;
1006 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XUDF); 1005 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XUDF);
1007 goto out; 1006 break;
1008 } 1007 }
1009 } while (stat); 1008 } while (stat);
1010 1009
1011out:
1012 omap_i2c_complete_cmd(dev, err); 1010 omap_i2c_complete_cmd(dev, err);
1011
1012out:
1013 spin_unlock_irqrestore(&dev->lock, flags); 1013 spin_unlock_irqrestore(&dev->lock, flags);
1014 1014
1015 return IRQ_HANDLED; 1015 return IRQ_HANDLED;