File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,8 +163,7 @@ static int wilc_sdio_probe(struct sdio_func *func,
163163 ret = wilc_cfg80211_init (& wilc , & func -> dev , io_type , & wilc_hif_sdio );
164164 if (ret ) {
165165 dev_err (& func -> dev , "Couldn't initialize netdev\n" );
166- kfree (sdio_priv );
167- return ret ;
166+ goto free ;
168167 }
169168 sdio_set_drvdata (func , wilc );
170169 wilc -> bus_data = sdio_priv ;
@@ -184,18 +183,20 @@ static int wilc_sdio_probe(struct sdio_func *func,
184183
185184 if (!init_power ) {
186185 ret = wilc_wlan_power_on_sequence (wilc );
187- if (ret ) {
188- wilc_netdev_cleanup (wilc );
189- kfree (sdio_priv );
190- return ret ;
191- }
186+ if (ret )
187+ goto netdev_cleanup ;
192188 init_power = 1 ;
193189 }
194190
195191 wilc_bt_init (wilc );
196192
197193 dev_info (& func -> dev , "Driver Initializing success\n" );
198194 return 0 ;
195+ netdev_cleanup :
196+ wilc_netdev_cleanup (wilc );
197+ free :
198+ kfree (sdio_priv );
199+ return ret ;
199200}
200201
201202static void wilc_sdio_remove (struct sdio_func * func )
Original file line number Diff line number Diff line change @@ -125,10 +125,8 @@ static int wilc_bus_probe(struct spi_device *spi)
125125 return - ENOMEM ;
126126
127127 ret = wilc_cfg80211_init (& wilc , dev , WILC_HIF_SPI , & wilc_hif_spi );
128- if (ret ) {
129- kfree (spi_priv );
130- return ret ;
131- }
128+ if (ret )
129+ goto free ;
132130
133131 spi_set_drvdata (spi , wilc );
134132 wilc -> dev = & spi -> dev ;
@@ -144,18 +142,20 @@ static int wilc_bus_probe(struct spi_device *spi)
144142
145143 if (!init_power ) {
146144 ret = wilc_wlan_power_on_sequence (wilc );
147- if (ret ) {
148- wilc_netdev_cleanup (wilc );
149- kfree (spi_priv );
150- return ret ;
151- }
145+ if (ret )
146+ goto netdev_cleanup ;
152147 init_power = 1 ;
153148 }
154149
155150 wilc_bt_init (wilc );
156151
157152 dev_info (dev , "WILC SPI probe success\n" );
158153 return 0 ;
154+ netdev_cleanup :
155+ wilc_netdev_cleanup (wilc );
156+ free :
157+ kfree (spi_priv );
158+ return ret ;
159159}
160160
161161static int wilc_bus_remove (struct spi_device * spi )
You can’t perform that action at this time.
0 commit comments