diff mbox series

[next] net: dsa: qca8k: return with -EINVAL on invalid port

Message ID 20220224220557.147075-1-colin.i.king@gmail.com (mailing list archive)
State Accepted
Commit 38455fbcc8ece5d4bdc0e6f380abd88db0b208e6
Delegated to: Netdev Maintainers
Headers show
Series [next] net: dsa: qca8k: return with -EINVAL on invalid port | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Colin Ian King Feb. 24, 2022, 10:05 p.m. UTC
Currently an invalid port throws a WARN_ON warning however invalid
uninitialized values in reg and cpu_port_index are being used later
on. Fix this by returning -EINVAL for an invalid port value.

Addresses clang-scan warnings:
drivers/net/dsa/qca8k.c:1981:3: warning: 2nd function call argument is an
  uninitialized value [core.CallAndMessage]
drivers/net/dsa/qca8k.c:1999:9: warning: 2nd function call argument is an
  uninitialized value [core.CallAndMessage]

Fixes: 7544b3ff745b ("net: dsa: qca8k: move pcs configuration")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/dsa/qca8k.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 26, 2022, 6:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 24 Feb 2022 22:05:57 +0000 you wrote:
> Currently an invalid port throws a WARN_ON warning however invalid
> uninitialized values in reg and cpu_port_index are being used later
> on. Fix this by returning -EINVAL for an invalid port value.
> 
> Addresses clang-scan warnings:
> drivers/net/dsa/qca8k.c:1981:3: warning: 2nd function call argument is an
>   uninitialized value [core.CallAndMessage]
> drivers/net/dsa/qca8k.c:1999:9: warning: 2nd function call argument is an
>   uninitialized value [core.CallAndMessage]
> 
> [...]

Here is the summary with links:
  - [next] net: dsa: qca8k: return with -EINVAL on invalid port
    https://git.kernel.org/netdev/net-next/c/38455fbcc8ec

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 04fa21e37dfa..2ed45f69b8e4 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1937,6 +1937,7 @@  static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
 
 	default:
 		WARN_ON(1);
+		return -EINVAL;
 	}
 
 	/* Enable/disable SerDes auto-negotiation as necessary */