[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2010270636470.7937@felia>
Date: Tue, 27 Oct 2020 07:59:27 +0100 (CET)
From: Lukas Bulwahn <lukas.bulwahn@...il.com>
To: Sudip Mukherjee <sudipm.mukherjee@...il.com>
cc: John Stultz <john.stultz@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linux-safety@...ts.elisa.tech
Subject: Re: [linux-safety] [PATCH] misc: hisi_hikey_usb: use
PTR_ERR_OR_ZERO
On Mon, 26 Oct 2020, Sudip Mukherjee wrote:
> Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code,
> we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then
> doing 'return 0'.
>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@...il.com>
A nice small local clean up.
Here is my test report:
Build requires HISI_HIKEY_USB in config:
Symbol: HISI_HIKEY_USB [=n]
Type: tristate
Defined at drivers/misc/Kconfig:459
Prompt: USB GPIO Hub on HiSilicon Hikey 960/970 Platform
Depends on: (OF [=n] && GPIOLIB [=n] || COMPILE_TEST [=n]) &&
USB_ROLE_SWITCH [=n]
Build Preparation:
make defconfig
./scripts/config -e CONFIG_OF
./scripts/config -e CONFIG_GPIOLIB
./scripts/config -e CONFIG_USB_ROLE_SWITCH
./scripts/config -e CONFIG_HISI_HIKEY_USB
make olddefconfig
Build on next-20201027:
make
md5sum ./drivers/misc/hisi_hikey_usb.o
770db9ff0c1ca193eda2207a28deee4a ./drivers/misc/hisi_hikey_usb.o
objdump -d ./drivers/misc/hisi_hikey_usb.o > hisi_hikey_usb.next-20201027.objdump
Build with patch on next-20201027:
make clean && make
md5sum ./drivers/misc/hisi_hikey_usb.o
770db9ff0c1ca193eda2207a28deee4a ./drivers/misc/hisi_hikey_usb.o
objdump -d ./drivers/misc/hisi_hikey_usb.o > hisi_hikey_usb.cleanup-on-next-20201027.objdump
Compare objdump:
diff hisi_hikey_usb.next-20201027.objdump hisi_hikey_usb.cleanup-on-next-20201027.objdump
Summary:
'{md5sum,objdump -d} ./drivers/misc/hisi_hikey_usb.o' are identical before
and after patch.
So, no functional change and no change in object code.
Tested-by: Lukas Bulwahn <lukas.bulwahn@...il.com>
> ---
> drivers/misc/hisi_hikey_usb.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/misc/hisi_hikey_usb.c b/drivers/misc/hisi_hikey_usb.c
> index cc93569e601c..989d7d129469 100644
> --- a/drivers/misc/hisi_hikey_usb.c
> +++ b/drivers/misc/hisi_hikey_usb.c
> @@ -168,10 +168,7 @@ static int hisi_hikey_usb_parse_kirin970(struct platform_device *pdev,
>
> hisi_hikey_usb->reset = devm_gpiod_get(&pdev->dev, "hub_reset_en_gpio",
> GPIOD_OUT_HIGH);
> - if (IS_ERR(hisi_hikey_usb->reset))
> - return PTR_ERR(hisi_hikey_usb->reset);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(hisi_hikey_usb->reset);
> }
>
> static int hisi_hikey_usb_probe(struct platform_device *pdev)
> --
> 2.11.0
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#121): https://lists.elisa.tech/g/linux-safety/message/121
> Mute This Topic: https://lists.elisa.tech/mt/77821561/1714638
> Group Owner: linux-safety+owner@...ts.elisa.tech
> Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [lukas.bulwahn@...il.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
>
Powered by blists - more mailing lists