[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 1/2] cleanup: Tweak and re-run return_directly.cocci |
Date: |
Tue, 22 Nov 2022 16:48:02 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
BALATON Zoltan <[email protected]> writes:
> On Tue, 22 Nov 2022, Markus Armbruster wrote:
>> Tweak the semantic patch to drop redundant parenthesis around the
>> return expression.
>>
>> Coccinelle drops a comment in hw/rdma/vmw/pvrdma_cmd.c; restored
>> manually.
>>
>> Coccinelle messes up vmdk_co_create(), not sure why. Change dropped,
>> will be done manually in the next commit.
>>
>> Line breaks in target/avr/cpu.h and hw/rdma/vmw/pvrdma_cmd.c tidied up
>> manually.
>>
>> Whitespace in tools/virtiofsd/fuse_lowlevel.c tidied up manually.
>>
>> checkpatch.pl complains "return of an errno should typically be -ve"
>> two times for hw/9pfs/9p-synth.c. Preexisting, the patch merely makes
>> it visible to checkpatch.pl.
>>
>> Signed-off-by: Markus Armbruster <[email protected]>
[...]
>> diff --git a/hw/ppc/ppc4xx_sdram.c b/hw/ppc/ppc4xx_sdram.c
>> index 8d7137faf3..54bf9a2b44 100644
>> --- a/hw/ppc/ppc4xx_sdram.c
>> +++ b/hw/ppc/ppc4xx_sdram.c
>> @@ -520,13 +520,10 @@ static inline hwaddr sdram_ddr2_base(uint32_t bcr)
>>
>> static hwaddr sdram_ddr2_size(uint32_t bcr)
>> {
>> - hwaddr size;
>> int sh;
>>
>> sh = 1024 - ((bcr >> 6) & 0x3ff);
>> - size = 8 * MiB * sh;
>> -
>> - return size;
>> + return 8 * MiB * sh;
>> }
>>
>> static uint32_t sdram_ddr2_dcr_read(void *opaque, int dcrn)
>
> There's also an sdram_ddr_size() that's similar and could be changed to
>
> return sh == 7 ? -1 : (4 * MiB) << sh;
>
> just to keep these two functions simliar but Coccinelle probably does not
> catch that. Also while you're at it the assigmment of sh could be moved to
> the declaration to save even more lines. As this then becomes more of a
> handwritten patch, maybe it should be a separate patch cleaning these two
> functions before the rest.
I think it needs to be separate to keep me off Peter's naughty list ;)
> Otherwise for this part (or separate patch as above):
>
> Reviewed-by: BALATON Zoltan <[email protected]>
Thanks!