All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes.
@ 2021-08-16 22:13 Jonathan Lemon
  2021-08-16 22:13 ` [PATCH net-next v2 1/4] ptp: ocp: Fix uninitialized variable warning spotted by clang Jonathan Lemon
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jonathan Lemon @ 2021-08-16 22:13 UTC (permalink / raw)
  To: kuba, davem, richardcochran; +Cc: kernel-team, netdev

Fix errors spotted by automated tools.

Add myself to the MAINTAINERS for the ptp_ocp driver.
--
v2: Add Fixes tags, fix NET_DEVLINK

Jonathan Lemon (4):
  ptp: ocp: Fix uninitialized variable warning spotted by clang.
  ptp: ocp: Fix error path for pci_ocp_device_init()
  ptp: ocp: Have Kconfig select NET_DEVLINK
  MAINTAINERS: Update for ptp_ocp driver.

 MAINTAINERS           | 6 ++++++
 drivers/ptp/Kconfig   | 1 +
 drivers/ptp/ptp_ocp.c | 9 +++++----
 3 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 1/4] ptp: ocp: Fix uninitialized variable warning spotted by clang.
  2021-08-16 22:13 [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes Jonathan Lemon
@ 2021-08-16 22:13 ` Jonathan Lemon
  2021-08-16 22:13 ` [PATCH net-next v2 2/4] ptp: ocp: Fix error path for pci_ocp_device_init() Jonathan Lemon
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jonathan Lemon @ 2021-08-16 22:13 UTC (permalink / raw)
  To: kuba, davem, richardcochran; +Cc: kernel-team, netdev

If attempting to flash the firmware with a blob of size 0,
the entire write loop is skipped and the uninitialized err
is returned.  Fix by setting to 0 first.

Fixes: 773bda964921 ("ptp: ocp: Expose various resources on the
timecard.")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 92edf772feed..9e4317d1184f 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -763,7 +763,7 @@ ptp_ocp_devlink_flash(struct devlink *devlink, struct device *dev,
 	size_t off, len, resid, wrote;
 	struct erase_info erase;
 	size_t base, blksz;
-	int err;
+	int err = 0;
 
 	off = 0;
 	base = bp->flash_start;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 2/4] ptp: ocp: Fix error path for pci_ocp_device_init()
  2021-08-16 22:13 [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes Jonathan Lemon
  2021-08-16 22:13 ` [PATCH net-next v2 1/4] ptp: ocp: Fix uninitialized variable warning spotted by clang Jonathan Lemon
@ 2021-08-16 22:13 ` Jonathan Lemon
  2021-08-16 22:13 ` [PATCH net-next v2 3/4] ptp: ocp: Have Kconfig select NET_DEVLINK Jonathan Lemon
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jonathan Lemon @ 2021-08-16 22:13 UTC (permalink / raw)
  To: kuba, davem, richardcochran; +Cc: kernel-team, netdev

If ptp_ocp_device_init() fails, pci_disable_device() is skipped.
Fix the error handling so this case is covered.  Update ptp_ocp_remove()
so the normal exit path is identical.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 773bda964921 ("ptp: ocp: Expose various resources on the
timecard.")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 9e4317d1184f..caf9b37c5eb1 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -1438,7 +1438,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	bp = devlink_priv(devlink);
 	err = ptp_ocp_device_init(bp, pdev);
 	if (err)
-		goto out_unregister;
+		goto out_disable;
 
 	/* compat mode.
 	 * Older FPGA firmware only returns 2 irq's.
@@ -1476,8 +1476,9 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 out:
 	ptp_ocp_detach(bp);
-	pci_disable_device(pdev);
 	pci_set_drvdata(pdev, NULL);
+out_disable:
+	pci_disable_device(pdev);
 out_unregister:
 	devlink_unregister(devlink);
 out_free:
@@ -1493,8 +1494,8 @@ ptp_ocp_remove(struct pci_dev *pdev)
 	struct devlink *devlink = priv_to_devlink(bp);
 
 	ptp_ocp_detach(bp);
-	pci_disable_device(pdev);
 	pci_set_drvdata(pdev, NULL);
+	pci_disable_device(pdev);
 
 	devlink_unregister(devlink);
 	devlink_free(devlink);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 3/4] ptp: ocp: Have Kconfig select NET_DEVLINK
  2021-08-16 22:13 [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes Jonathan Lemon
  2021-08-16 22:13 ` [PATCH net-next v2 1/4] ptp: ocp: Fix uninitialized variable warning spotted by clang Jonathan Lemon
  2021-08-16 22:13 ` [PATCH net-next v2 2/4] ptp: ocp: Fix error path for pci_ocp_device_init() Jonathan Lemon
@ 2021-08-16 22:13 ` Jonathan Lemon
  2021-08-16 22:13 ` [PATCH net-next v2 4/4] MAINTAINERS: Update for ptp_ocp driver Jonathan Lemon
  2021-08-17  0:40 ` [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Jonathan Lemon @ 2021-08-16 22:13 UTC (permalink / raw)
  To: kuba, davem, richardcochran; +Cc: kernel-team, netdev

NET doesn't imply NET_DEVLINK.  Select this separately, so that
random config combinations don't complain.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 773bda964921 ("ptp: ocp: Expose various resources on the
timecard.")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
 drivers/ptp/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index 823eae1b4b53..8ad88c3e79aa 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -177,6 +177,7 @@ config PTP_1588_CLOCK_OCP
 	imply MTD_SPI_NOR
 	imply I2C_XILINX
 	select SERIAL_8250
+	select NET_DEVLINK
 
 	default n
 	help
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v2 4/4] MAINTAINERS: Update for ptp_ocp driver.
  2021-08-16 22:13 [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes Jonathan Lemon
                   ` (2 preceding siblings ...)
  2021-08-16 22:13 ` [PATCH net-next v2 3/4] ptp: ocp: Have Kconfig select NET_DEVLINK Jonathan Lemon
@ 2021-08-16 22:13 ` Jonathan Lemon
  2021-08-17  0:40 ` [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Jonathan Lemon @ 2021-08-16 22:13 UTC (permalink / raw)
  To: kuba, davem, richardcochran; +Cc: kernel-team, netdev

Add maintainer info for the OpenCompute PTP driver.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2da75be3fb3f..43ec27b32ee5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13885,6 +13885,12 @@ F:	Documentation/devicetree/
 F:	arch/*/boot/dts/
 F:	include/dt-bindings/
 
+OPENCOMPUTE PTP CLOCK DRIVER
+M:	Jonathan Lemon <jonathan.lemon@gmail.com>
+L:	netdev@vger.kernel.org
+S:	Maintained
+F:	drivers/ptp/ptp_ocp.c
+
 OPENCORES I2C BUS DRIVER
 M:	Peter Korsgaard <peter@korsgaard.com>
 M:	Andrew Lunn <andrew@lunn.ch>
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes.
  2021-08-16 22:13 [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes Jonathan Lemon
                   ` (3 preceding siblings ...)
  2021-08-16 22:13 ` [PATCH net-next v2 4/4] MAINTAINERS: Update for ptp_ocp driver Jonathan Lemon
@ 2021-08-17  0:40 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-17  0:40 UTC (permalink / raw)
  To: Jonathan Lemon; +Cc: kuba, davem, richardcochran, kernel-team, netdev

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Mon, 16 Aug 2021 15:13:33 -0700 you wrote:
> Fix errors spotted by automated tools.
> 
> Add myself to the MAINTAINERS for the ptp_ocp driver.
> --
> v2: Add Fixes tags, fix NET_DEVLINK
> 
> Jonathan Lemon (4):
>   ptp: ocp: Fix uninitialized variable warning spotted by clang.
>   ptp: ocp: Fix error path for pci_ocp_device_init()
>   ptp: ocp: Have Kconfig select NET_DEVLINK
>   MAINTAINERS: Update for ptp_ocp driver.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/4] ptp: ocp: Fix uninitialized variable warning spotted by clang.
    https://git.kernel.org/netdev/net-next/c/7c8075728f4d
  - [net-next,v2,2/4] ptp: ocp: Fix error path for pci_ocp_device_init()
    https://git.kernel.org/netdev/net-next/c/d9fdbf132dab
  - [net-next,v2,3/4] ptp: ocp: Have Kconfig select NET_DEVLINK
    https://git.kernel.org/netdev/net-next/c/d79500e66a52
  - [net-next,v2,4/4] MAINTAINERS: Update for ptp_ocp driver.
    https://git.kernel.org/netdev/net-next/c/b40fb16df9f4

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-17  0:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 22:13 [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes Jonathan Lemon
2021-08-16 22:13 ` [PATCH net-next v2 1/4] ptp: ocp: Fix uninitialized variable warning spotted by clang Jonathan Lemon
2021-08-16 22:13 ` [PATCH net-next v2 2/4] ptp: ocp: Fix error path for pci_ocp_device_init() Jonathan Lemon
2021-08-16 22:13 ` [PATCH net-next v2 3/4] ptp: ocp: Have Kconfig select NET_DEVLINK Jonathan Lemon
2021-08-16 22:13 ` [PATCH net-next v2 4/4] MAINTAINERS: Update for ptp_ocp driver Jonathan Lemon
2021-08-17  0:40 ` [PATCH net-next v2 0/4] ptp: ocp: minor updates and fixes patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.