Skip to content

Commit 52f9fcb

Browse files
committed
firewire: ohci: fix error path to detect initiated reset in TI TSB41BA3D phy
A commit 404957c ("firewire: ohci: use guard macro to serialize accesses to phy registers") refactored initiated_reset() helper function, while the error path was changed wrongly. This commit fixes the bug. Reported-by: Dan Carpenter <[email protected]> Fixes: 80f3401 ("firewire: ohci: use guard macro to serialize accesses to phy registers") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent e8b89bc commit 52f9fcb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/firewire/ohci.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,7 +1919,7 @@ static int get_self_id_pos(struct fw_ohci *ohci, u32 self_id,
19191919
return i;
19201920
}
19211921

1922-
static bool initiated_reset(struct fw_ohci *ohci)
1922+
static int detect_initiated_reset(struct fw_ohci *ohci, bool *is_initiated_reset)
19231923
{
19241924
int reg;
19251925

@@ -1946,7 +1946,9 @@ static bool initiated_reset(struct fw_ohci *ohci)
19461946
return reg;
19471947

19481948
// bit 3 indicates "initiated reset"
1949-
return !!((reg & 0x08) == 0x08);
1949+
*is_initiated_reset = !!((reg & 0x08) == 0x08);
1950+
1951+
return 0;
19501952
}
19511953

19521954
/*
@@ -1956,7 +1958,8 @@ static bool initiated_reset(struct fw_ohci *ohci)
19561958
*/
19571959
static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count)
19581960
{
1959-
int reg, i, pos;
1961+
int reg, i, pos, err;
1962+
bool is_initiated_reset;
19601963
u32 self_id = 0;
19611964

19621965
// link active 1, speed 3, bridge 0, contender 1, more packets 0.
@@ -1985,7 +1988,6 @@ static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count)
19851988

19861989
for (i = 0; i < 3; i++) {
19871990
enum phy_packet_self_id_port_status status;
1988-
int err;
19891991

19901992
err = get_status_for_port(ohci, i, &status);
19911993
if (err < 0)
@@ -1994,7 +1996,10 @@ static int find_and_insert_self_id(struct fw_ohci *ohci, int self_id_count)
19941996
self_id_sequence_set_port_status(&self_id, 1, i, status);
19951997
}
19961998

1997-
phy_packet_self_id_zero_set_initiated_reset(&self_id, initiated_reset(ohci));
1999+
err = detect_initiated_reset(ohci, &is_initiated_reset);
2000+
if (err < 0)
2001+
return err;
2002+
phy_packet_self_id_zero_set_initiated_reset(&self_id, is_initiated_reset);
19982003

19992004
pos = get_self_id_pos(ohci, self_id, self_id_count);
20002005
if (pos >= 0) {

0 commit comments

Comments
 (0)