Skip to content

Commit 083ad04

Browse files
Ondrej ZaryDamien Le Moal
authored andcommitted
ata: pata_parport-bpck6: reduce indents in bpck6_open
Reverse error handling conditions to reduce code indents in bpck6_open. Signed-off-by: Ondrej Zary <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 49745f6 commit 083ad04

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

drivers/ata/pata_parport/bpck6.c

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -318,30 +318,32 @@ static int bpck6_open(struct pi_adapter *pi)
318318

319319
j = ((i & 0x08) << 4) | ((i & 0x07) << 3);
320320
k = parport_read_status(pi->pardev->port) & 0xB8;
321-
if (j == k) {
322-
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0);
323-
k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8;
324-
if (j == k) {
325-
if (i & 4) // EPP
326-
parport_frob_control(pi->pardev->port,
327-
PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0);
328-
else // PPC/ECP
329-
parport_frob_control(pi->pardev->port,
330-
PARPORT_CONTROL_SELECT, 0);
331-
332-
pi->private = 0;
333-
334-
bpck6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE);
335-
bpck6_wr_data_byte(pi, RAMSIZE_128K);
336-
337-
bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION);
338-
if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C)
339-
pi->private |= fifo_wait;
340-
341-
return 1;
342-
}
343-
}
321+
if (j != k)
322+
goto fail;
323+
324+
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_AUTOFD, 0);
325+
k = (parport_read_status(pi->pardev->port) & 0xB8) ^ 0xB8;
326+
if (j != k)
327+
goto fail;
328+
329+
if (i & 4) // EPP
330+
parport_frob_control(pi->pardev->port,
331+
PARPORT_CONTROL_SELECT | PARPORT_CONTROL_INIT, 0);
332+
else // PPC/ECP
333+
parport_frob_control(pi->pardev->port, PARPORT_CONTROL_SELECT, 0);
334+
335+
pi->private = 0;
336+
337+
bpck6_send_cmd(pi, ACCESS_REG | ACCESS_WRITE | REG_RAMSIZE);
338+
bpck6_wr_data_byte(pi, RAMSIZE_128K);
339+
340+
bpck6_send_cmd(pi, ACCESS_REG | ACCESS_READ | REG_VERSION);
341+
if ((bpck6_rd_data_byte(pi) & 0x3F) == 0x0C)
342+
pi->private |= fifo_wait;
343+
344+
return 1;
344345

346+
fail:
345347
parport_write_control(pi->pardev->port, pi->saved_r2);
346348
parport_write_data(pi->pardev->port, pi->saved_r0);
347349

0 commit comments

Comments
 (0)