Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb-frontends: delete jump targets

* Return directly after a call of the function "kzalloc" failed
at the beginning.

* Move a bit of exception handling code into an if branch.

* Delete jump targets which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>

authored by

Markus Elfring and committed by
Mauro Carvalho Chehab
9722e569 af28c996

+14 -29
+1 -1
drivers/media/dvb-frontends/cx24113.c
··· 556 556 int rc; 557 557 558 558 if (!state) 559 - goto error; 559 + return NULL; 560 560 561 561 /* setup the state */ 562 562 state->config = config;
+5 -10
drivers/media/dvb-frontends/cx24116.c
··· 226 226 u8 *buf; 227 227 228 228 buf = kmalloc(len + 1, GFP_KERNEL); 229 - if (buf == NULL) { 230 - ret = -ENOMEM; 231 - goto error; 232 - } 229 + if (!buf) 230 + return -ENOMEM; 233 231 234 232 *(buf) = reg; 235 233 memcpy(buf + 1, data, len); ··· 248 250 ret = -EREMOTEIO; 249 251 } 250 252 251 - error: 252 253 kfree(buf); 253 254 254 255 return ret; ··· 1125 1128 /* allocate memory for the internal state */ 1126 1129 state = kzalloc(sizeof(*state), GFP_KERNEL); 1127 1130 if (state == NULL) 1128 - goto error1; 1131 + return NULL; 1129 1132 1130 1133 state->config = config; 1131 1134 state->i2c = i2c; ··· 1134 1137 ret = (cx24116_readreg(state, 0xFF) << 8) | 1135 1138 cx24116_readreg(state, 0xFE); 1136 1139 if (ret != 0x0501) { 1140 + kfree(state); 1137 1141 printk(KERN_INFO "Invalid probe, probably not a CX24116 device\n"); 1138 - goto error2; 1142 + return NULL; 1139 1143 } 1140 1144 1141 1145 /* create dvb_frontend */ ··· 1144 1146 sizeof(struct dvb_frontend_ops)); 1145 1147 state->frontend.demodulator_priv = state; 1146 1148 return &state->frontend; 1147 - 1148 - error2: kfree(state); 1149 - error1: return NULL; 1150 1149 } 1151 1150 EXPORT_SYMBOL(cx24116_attach); 1152 1151
+3 -7
drivers/media/dvb-frontends/ds3000.c
··· 841 841 /* allocate memory for the internal state */ 842 842 state = kzalloc(sizeof(*state), GFP_KERNEL); 843 843 if (!state) 844 - goto error2; 844 + return NULL; 845 845 846 846 state->config = config; 847 847 state->i2c = i2c; ··· 850 850 /* check if the demod is present */ 851 851 ret = ds3000_readreg(state, 0x00) & 0xfe; 852 852 if (ret != 0xe0) { 853 + kfree(state); 853 854 printk(KERN_ERR "Invalid probe, probably not a DS3000\n"); 854 - goto error3; 855 + return NULL; 855 856 } 856 857 857 858 printk(KERN_INFO "DS3000 chip version: %d.%d attached.\n", ··· 870 869 */ 871 870 ds3000_set_voltage(&state->frontend, SEC_VOLTAGE_OFF); 872 871 return &state->frontend; 873 - 874 - error3: 875 - kfree(state); 876 - error2: 877 - return NULL; 878 872 } 879 873 EXPORT_SYMBOL(ds3000_attach); 880 874
+5 -11
drivers/media/dvb-frontends/mb86a20s.c
··· 2073 2073 /* allocate memory for the internal state */ 2074 2074 state = kzalloc(sizeof(*state), GFP_KERNEL); 2075 2075 if (!state) 2076 - goto error; 2076 + return NULL; 2077 2077 2078 2078 /* setup the state */ 2079 2079 state->config = config; ··· 2086 2086 2087 2087 /* Check if it is a mb86a20s frontend */ 2088 2088 rev = mb86a20s_readreg(state, 0); 2089 - 2090 - if (rev == 0x13) { 2091 - dev_info(&i2c->dev, 2092 - "Detected a Fujitsu mb86a20s frontend\n"); 2093 - } else { 2089 + if (rev != 0x13) { 2090 + kfree(state); 2094 2091 dev_dbg(&i2c->dev, 2095 2092 "Frontend revision %d is unknown - aborting.\n", 2096 2093 rev); 2097 - goto error; 2094 + return NULL; 2098 2095 } 2099 2096 2097 + dev_info(&i2c->dev, "Detected a Fujitsu mb86a20s frontend\n"); 2100 2098 return &state->frontend; 2101 - 2102 - error: 2103 - kfree(state); 2104 - return NULL; 2105 2099 } 2106 2100 EXPORT_SYMBOL(mb86a20s_attach); 2107 2101