From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796454680; b=4Nf2eVouhkCQyx/YsedE/tRRa+KShSjF+kD0Y6VtsQq1a/ESknMf4ujKrFhj26pMOjb7 hst3xnyQnyQnVK7c/a/MW+zMwERd/tnVRkZOo4Ub8K0mdR1cq1Sc0JFFWhft2nTUALxjj WAupGsE+vN80lieR2J1PQuiWLlXaUVncF5RJ32Aalh+bUOb1qzYP3qEMaNHovV2WPcWtz 2+9ypLtnmiIhv/R/4RCol2RyIlgwpDP5In/jT2LqhtVoETxUsKPvhnGEscSAWbEVEbBmd Q/CIqmVlNM4G/eQ2/QWQw99UhSl25bTsR22CKezfUnObG9d2qVkRdpo5r50xowRy4kg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796454680; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=cwF5jUE+qgHT8w1zb6ziXr/R1aP/+diQdCwWZQkwwKI=; b=wBGefs54z7JHc8n39S13be8/Qacs4pyxNjHTfZm5EkZrxUnkAmQwGw+PL+Pc6oZ6E6qp wp/NxrDAPWkuGSx40t8ZPtPTdw3VE+2eCYKYuRXcEuZ6WkEb3IW4Vr4f5FxDGQBVA6Up/ B8Ne4wyve94Wky+MykjGAZDxRRKXVwIvI4mxeKdbZV80DnIYd/N9sFYHy3ZME0w4/ojQk 2UeuUdzqE/Im6ppe5lh7wQm6cVPLlPpF0pnIjOnMLkf3lKE3esfO387BhqXp7HODu0njM 44RFBfm9Ccxm+kBzptpF+6kO1IurG4FDVeQFOnTNOivvgoOqHdOadhv2dQAJ1hJ+A3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZlZIIMlX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 744F1606A332 for ; Sat, 5 Dec 2026 07:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZlZIIMlX Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B4A1F0092B; Sat, 5 Dec 2026 07:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796454680; bh=cwF5jUE+qgHT8w1zb6ziXr/R1aP/+diQdCwWZQkwwKI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ZlZIIMlXuWxu5cc/pUyf8GQExOIXmrOuF+mWrVbNw6+kVfmHBYowUN5LpjlT6hzIW KgJj5+D1vBRp2gIV3PaomJNjYB4XV9WMIL4+wZ7M6gunR3TT+4t0a0LV6IbJJ3Jp+Z FRpntstI3x7i7dP2pfnIFGTdON79jTkRoZneXU0IR5QSPFp5v9STFB/iGyI9PH72XY 5zQ6CKniSCoz4UurLx0l8bIvg4veO7EVfyRlLT1MPFYnsgL/p1gbksUXZKxUHBwaS6 Dcn9sAyhd8wi6Zle78O+uBiP1QAiDSTg/8ldpFo79E0DBZ16VjgwSpG0TuhyKAB61s pIqKQzfk4nBrQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next 11/14] net: enetc: add a generic helper to update an NTMP entry by entry ID Reply-To: sashiko-reviews@lists.linux.dev To: wei.fang@oss.nxp.com Cc: imx@lists.linux.dev, Frank.Li@kernel.org In-Reply-To: <20261204071410.692071-12-wei.fang@oss.nxp.com> References: <20261204071410.692071-1-wei.fang@oss.nxp.com> <20261204071410.692071-12-wei.fang@oss.nxp.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 07:11:18 +0000 X-Mailing-List: imx@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] net: enetc: non-const entry in ntmp_update_entry_by_id() casts away const - [Low] net: enetc: ntmp_update_entry_by_id() duplicates ntmp_add_entry_by_id() -- commit c5efa87d2b61e70c01da22c7e8bb3461799cdac9 Author: Wei Fang net: enetc: add a generic helper to update an NTMP entry by entry ID This commit adds a generic ntmp_update_entry_by_id() helper to update NTMP table entries by entry ID and converts ntmp_fdbt_update_entry(), ntmp_ett_update_entry(), and ntmp_bpt_update_entry() to use it. > diff --git a/drivers/net/ethernet/freescale/enetc/ntmp.c b/drivers/net/et= hernet/freescale/enetc/ntmp.c > index 837bb37a349fe..a0605f0d0b106 100644 > --- a/drivers/net/ethernet/freescale/enetc/ntmp.c > +++ b/drivers/net/ethernet/freescale/enetc/ntmp.c > @@ -710,6 +710,61 @@ static int ntmp_add_entry_by_id(struct ntmp_user *us= er, int tbl_id, > return err; > } [ ... ] > +static int ntmp_update_entry_by_id(struct ntmp_user *user, int tbl_id, > + u32 entry_id, void *entry, u16 ua, > + u32 resp_len) [Severity: Low] Can entry be const void * instead of void *? It is only passed to ops->pack(), which already takes const void *. Leaving it non-const forces ntmp_fdbt_update_entry() and ntmp_ett_update_entry() to cast away const with (void *)entry, and adds an unnecessary (void *) cast in ntmp_bpt_update_entry(). > +{ > + u8 version =3D user->tbl_ver[tbl_id]; > + const struct ntmp_tbl_ops *ops; > + struct netc_swcbd swcbd; > + struct netc_cbdr *cbdr; > + union netc_cbd cbd; > + void *buf; > + u32 len; > + int err; > + > + ops =3D ntmp_table_ops(tbl_id, version); > + if (!ops) > + return -EOPNOTSUPP; > + > + swcbd.size =3D max(ops->req_ua_len, resp_len); > + err =3D ntmp_alloc_data_mem(user->dev, &swcbd, &buf); > + if (err) > + return err; > + > + ntmp_fill_crd_eid(buf, version, 0, ua, entry_id); > + ops->pack(entry, buf, NTMP_AM_ENTRY_ID); > + > + len =3D NTMP_LEN(ops->req_ua_len, resp_len); > + ntmp_fill_request_hdr(&cbd, swcbd.dma, len, tbl_id, > + NTMP_CMD_UPDATE, NTMP_AM_ENTRY_ID); > + > + ntmp_select_and_lock_cbdr(user, &cbdr); > + err =3D netc_xmit_ntmp_cmd(cbdr, &cbd, &swcbd); > + if (err) > + dev_err(user->dev, > + "Failed to update %s entry 0x%x, err: %pe\n", > + ntmp_table_name(tbl_id), entry_id, ERR_PTR(err)); > + ntmp_unlock_cbdr(cbdr); > + > + return err; > +} [Severity: Low] Could ntmp_update_entry_by_id() and ntmp_add_entry_by_id() share a single internal helper? Both run the same allocation, packing, and submission sequence, differing only in the opcode (NTMP_CMD_ADD vs NTMP_CMD_UPDATE), resp_len (0 vs resp_len), and the verb in dev_err(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204071410.6920= 71-1-wei.fang@oss.nxp.com?part=3D11