Re: [PATCH 12/31] swim: Simplify return value initialization

Laurent Vivier <[email protected]> Mon, 20 Jul 2026 21:21:32 +0200
Newsgroups org.kernel.vger.linux-m68k,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Le 16/07/2026 =C3=A0 12:02, Finn Thain a =C3=A9crit=C2=A0:
> Initialize the error result once only. Update the result only after a
> successful read.
>=20
> Signed-off-by: Finn Thain <[email protected]>
> ---
>   drivers/block/swim_asm.S | 11 +++--------
>   1 file changed, 3 insertions(+), 8 deletions(-)

Reviewed-by: Laurent Vivier <[email protected]>

>=20
> diff --git a/drivers/block/swim_asm.S b/drivers/block/swim_asm.S
> index 208622ac4aeb..31fc63b074dc 100644
> --- a/drivers/block/swim_asm.S
> +++ b/drivers/block/swim_asm.S
> @@ -47,6 +47,7 @@ swim_read_sector_header:
>   	link	%a6, #0
>   	moveml	%d1-%d5/%a0-%a4,%sp@-
>   	movel	%a6@(0x0c), %a4
> +	moveq	#-1, %d0
>   	bsr	mfm_read_addrmark
>   	moveml	%sp@+, %d1-%d5/%a0-%a4
>   	unlk	%a6
> @@ -61,7 +62,6 @@ mfm_read_addrmark:
>   	movel	%a6@(0x08), %a3
>   	lea	%a3@(read_handshake), %a2
>   	lea	%a3@(read_mark), %a3
> -	moveq	#-1, %d0
>   	movew	#seek_time, %d2
>  =20
>   wait_header_init:
> @@ -137,10 +137,7 @@ crc1:	tstb	%a2@
>   	tstb	%a3@(read_error - read_mark)
>  =20
>   	moveq	#0, %d0
> -	moveb	#0x18, %a3@(write_mode0 - read_mark)
> -	rts
>   signal_nonyb:
> -	moveq	#-1, %d0
>   	moveb	#0x18, %a3@(write_mode0 - read_mark)
>   	rts
>  =20
> @@ -149,6 +146,7 @@ swim_read_sector_data:
>   	link	%a6, #0
>   	moveml	%d1-%d5/%a0-%a5,%sp@-
>   	movel	%a6@(0x0c), %a4
> +	moveq	#-1, %d0
>   	bsr	mfm_read_data
>   	moveml	%sp@+, %d1-%d5/%a0-%a5
>   	unlk	%a6
> @@ -228,15 +226,12 @@ data_crc1:
>  =20
>   	tstb	%a3@(read_error - read_mark)
>  =20
> -	moveb	#0x18, %a3@(write_mode0 - read_mark)
> -
>   	/* return number of bytes read */
>  =20
>   	movel	#sector_size, %d0
>   	addw	#1, %d4
>   	subl	%d4, %d0
> -	rts
> +
>   data_exit:
>   	moveb	#0x18, %a3@(write_mode0 - read_mark)
> -	moveq	#-1, %d0
>   	rts