@@ -151,36 +151,38 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
151151
152152struct pcmcia_config_check {
153153 config_info_t conf ;
154- cistpl_cftable_entry_t dflt ;
155154 unsigned long ctl_base ;
156155 int skip_vcc ;
157156 int is_kme ;
158157};
159158
160159static int pcmcia_check_one_config (struct pcmcia_device * pdev ,
161160 cistpl_cftable_entry_t * cfg ,
161+ cistpl_cftable_entry_t * dflt ,
162162 void * priv_data )
163163{
164164 struct pcmcia_config_check * stk = priv_data ;
165165
166166 /* Check for matching Vcc, unless we're desperate */
167167 if (!stk -> skip_vcc ) {
168168 if (cfg -> vcc .present & (1 << CISTPL_POWER_VNOM )) {
169- if (stk -> conf .Vcc != cfg -> vcc .param [CISTPL_POWER_VNOM ] / 10000 )
170- goto next_entry ;
171- } else if (stk -> dflt .vcc .present & (1 << CISTPL_POWER_VNOM )) {
172- if (stk -> conf .Vcc != stk -> dflt .vcc .param [CISTPL_POWER_VNOM ] / 10000 )
173- goto next_entry ;
169+ if (stk -> conf .Vcc !=
170+ cfg -> vcc .param [CISTPL_POWER_VNOM ] / 10000 )
171+ return - ENODEV ;
172+ } else if (dflt -> vcc .present & (1 << CISTPL_POWER_VNOM )) {
173+ if (stk -> conf .Vcc !=
174+ dflt -> vcc .param [CISTPL_POWER_VNOM ] / 10000 )
175+ return - ENODEV ;
174176 }
175177 }
176178
177179 if (cfg -> vpp1 .present & (1 << CISTPL_POWER_VNOM ))
178180 pdev -> conf .Vpp = cfg -> vpp1 .param [CISTPL_POWER_VNOM ] / 10000 ;
179- else if (stk -> dflt . vpp1 .present & (1 << CISTPL_POWER_VNOM ))
180- pdev -> conf .Vpp = stk -> dflt . vpp1 .param [CISTPL_POWER_VNOM ] / 10000 ;
181+ else if (dflt -> vpp1 .present & (1 << CISTPL_POWER_VNOM ))
182+ pdev -> conf .Vpp = dflt -> vpp1 .param [CISTPL_POWER_VNOM ] / 10000 ;
181183
182- if ((cfg -> io .nwin > 0 ) || (stk -> dflt . io .nwin > 0 )) {
183- cistpl_io_t * io = (cfg -> io .nwin ) ? & cfg -> io : & stk -> dflt . io ;
184+ if ((cfg -> io .nwin > 0 ) || (dflt -> io .nwin > 0 )) {
185+ cistpl_io_t * io = (cfg -> io .nwin ) ? & cfg -> io : & dflt -> io ;
184186 pdev -> io .BasePort1 = io -> win [0 ].base ;
185187 pdev -> io .IOAddrLines = io -> flags & CISTPL_IO_LINES_MASK ;
186188 if (!(io -> flags & CISTPL_IO_16BIT ))
@@ -190,23 +192,19 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
190192 pdev -> io .BasePort2 = io -> win [1 ].base ;
191193 pdev -> io .NumPorts2 = (stk -> is_kme ) ? 2 : 1 ;
192194 if (pcmcia_request_io (pdev , & pdev -> io ) != 0 )
193- goto next_entry ;
195+ return - ENODEV ;
194196 stk -> ctl_base = pdev -> io .BasePort2 ;
195197 } else if ((io -> nwin == 1 ) && (io -> win [0 ].len >= 16 )) {
196198 pdev -> io .NumPorts1 = io -> win [0 ].len ;
197199 pdev -> io .NumPorts2 = 0 ;
198200 if (pcmcia_request_io (pdev , & pdev -> io ) != 0 )
199- goto next_entry ;
201+ return - ENODEV ;
200202 stk -> ctl_base = pdev -> io .BasePort1 + 0x0e ;
201203 } else
202- goto next_entry ;
204+ return - ENODEV ;
203205 /* If we've got this far, we're done */
204206 return 0 ;
205207 }
206- next_entry :
207- if (cfg -> flags & CISTPL_CFTABLE_DEFAULT )
208- memcpy (& stk -> dflt , cfg , sizeof (stk -> dflt ));
209-
210208 return - ENODEV ;
211209}
212210
@@ -264,7 +262,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
264262 CS_CHECK (GetConfigurationInfo , pcmcia_get_configuration_info (pdev , & stk -> conf ));
265263 stk -> skip_vcc = io_base = ctl_base = 0 ;
266264 if (pcmcia_loop_config (pdev , pcmcia_check_one_config , stk )) {
267- memset (& stk -> dflt , 0 , sizeof (stk -> dflt ));
268265 stk -> skip_vcc = 1 ;
269266 if (pcmcia_loop_config (pdev , pcmcia_check_one_config , stk ))
270267 goto failed ; /* No suitable config found */
0 commit comments