2021-12-15 06:08:33

by CGEL

[permalink] [raw]
Subject: [PATCH ptp-next] drivers/ptp: remove redundant variable

From: Minghao Chi <[email protected]>

Return value directly instead of taking this
in another redundant variable.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Minghao Chi <[email protected]>
---
drivers/ptp/ptp_pch.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c
index 8070f3fd98f0..9132aaa70a2d 100644
--- a/drivers/ptp/ptp_pch.c
+++ b/drivers/ptp/ptp_pch.c
@@ -193,11 +193,8 @@ EXPORT_SYMBOL(pch_ch_control_write);
u32 pch_ch_event_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
- u32 val;
-
- val = ioread32(&chip->regs->ch_event);

- return val;
+ return ioread32(&chip->regs->ch_event);
}
EXPORT_SYMBOL(pch_ch_event_read);

@@ -212,22 +209,16 @@ EXPORT_SYMBOL(pch_ch_event_write);
u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
- u32 val;

- val = ioread32(&chip->regs->src_uuid_lo);
-
- return val;
+ return ioread32(&chip->regs->src_uuid_lo);
}
EXPORT_SYMBOL(pch_src_uuid_lo_read);

u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
{
struct pch_dev *chip = pci_get_drvdata(pdev);
- u32 val;

- val = ioread32(&chip->regs->src_uuid_hi);
-
- return val;
+ return ioread32(&chip->regs->src_uuid_hi);
}
EXPORT_SYMBOL(pch_src_uuid_hi_read);

@@ -663,12 +654,9 @@ static void __exit ptp_pch_exit(void)

static s32 __init ptp_pch_init(void)
{
- s32 ret;
-
/* register the driver with the pci core */
- ret = pci_register_driver(&pch_driver);

- return ret;
+ return pci_register_driver(&pch_driver);
}

module_init(ptp_pch_init);
--
2.25.1



2021-12-15 14:42:29

by Richard Cochran

[permalink] [raw]
Subject: Re: [PATCH ptp-next] drivers/ptp: remove redundant variable

On Wed, Dec 15, 2021 at 06:08:25AM +0000, [email protected] wrote:
> From: Minghao Chi <[email protected]>
>
> Return value directly instead of taking this
> in another redundant variable.
>
> Reported-by: Zeal Robot <[email protected]>

NAK. The original version is fine as it. Please teach your robot not
to generate churn.

Thanks,
Richard