diff mbox series

net: dsa: mv88e6xxx: add an error code check in mv88e6352_tai_event_work

Message ID 20231020090003.200092-1-suhui@nfschina.com (mailing list archive)
State Accepted
Commit a792197f50705a5855b592fde3312e1e373862e5
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: mv88e6xxx: add an error code check in mv88e6352_tai_event_work | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1363 this patch: 1363
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1388 this patch: 1388
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1388 this patch: 1388
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Su Hui Oct. 20, 2023, 9 a.m. UTC
mv88e6xxx_tai_write() can return error code (-EOPNOTSUPP ...) if failed.
So check the value of 'ret' after calling mv88e6xxx_tai_write().

Signed-off-by: Su Hui <suhui@nfschina.com>
---
 drivers/net/dsa/mv88e6xxx/ptp.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Vladimir Oltean Oct. 20, 2023, 10:07 a.m. UTC | #1
On Fri, Oct 20, 2023 at 05:00:04PM +0800, Su Hui wrote:
> mv88e6xxx_tai_write() can return error code (-EOPNOTSUPP ...) if failed.
> So check the value of 'ret' after calling mv88e6xxx_tai_write().
> 
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---

mv88e6xxx_avb_ops :: tai_read() and tai_write() come in pairs for the
existing implementations. So, a missing tai_write() method also implies
a missing tai_read() and would have been caught by the previous call to
mv88e6xxx_tai_read() in this function.

But, ok.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

This is a patch for net-next, as it doesn't fix any user-visible issue
and is just an improvement. For future changes, please note your
expectation regarding the target tree yourself, by formatting the patch
as "[PATCH net-next]".
patchwork-bot+netdevbpf@kernel.org Oct. 21, 2023, 11 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 20 Oct 2023 17:00:04 +0800 you wrote:
> mv88e6xxx_tai_write() can return error code (-EOPNOTSUPP ...) if failed.
> So check the value of 'ret' after calling mv88e6xxx_tai_write().
> 
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>  drivers/net/dsa/mv88e6xxx/ptp.c | 4 ++++
>  1 file changed, 4 insertions(+)

Here is the summary with links:
  - net: dsa: mv88e6xxx: add an error code check in mv88e6352_tai_event_work
    https://git.kernel.org/netdev/net-next/c/a792197f5070

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
index ea17231dc34e..56391e09b325 100644
--- a/drivers/net/dsa/mv88e6xxx/ptp.c
+++ b/drivers/net/dsa/mv88e6xxx/ptp.c
@@ -182,6 +182,10 @@  static void mv88e6352_tai_event_work(struct work_struct *ugly)
 	mv88e6xxx_reg_lock(chip);
 	err = mv88e6xxx_tai_write(chip, MV88E6XXX_TAI_EVENT_STATUS, status[0]);
 	mv88e6xxx_reg_unlock(chip);
+	if (err) {
+		dev_err(chip->dev, "failed to write TAI status register\n");
+		return;
+	}
 
 	/* This is an external timestamp */
 	ev.type = PTP_CLOCK_EXTTS;