All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 6165/12612] drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
@ 2021-06-23 17:03 ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-06-23 17:03 UTC (permalink / raw)
  To: Alex Elder; +Cc: kbuild-all, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d61c8b66c84080ecf8f9f4d9272ab4ec78029a59
commit: 5567d4d9e7381230462a564d4f466177f3ba9dd5 [6165/12612] net: ipa: add support for inline checksum offload
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)
>> drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
        : IPA_CS_OFFLOAD_INLINE;
        ^

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> net/sctp/socket.c:6135:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
     to += addrlen;
     ^
>> net/sctp/socket.c:6137:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg]
     space_left -= addrlen;
     ^

vim +478 drivers/net/ipa/ipa_endpoint.c

   456	
   457	static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint)
   458	{
   459		u32 offset = IPA_REG_ENDP_INIT_CFG_N_OFFSET(endpoint->endpoint_id);
   460		enum ipa_cs_offload_en enabled;
   461		u32 val = 0;
   462	
   463		/* FRAG_OFFLOAD_EN is 0 */
   464		if (endpoint->data->checksum) {
   465			enum ipa_version version = endpoint->ipa->version;
   466	
   467			if (endpoint->toward_ipa) {
   468				u32 checksum_offset;
   469	
   470				/* Checksum header offset is in 4-byte units */
   471				checksum_offset = sizeof(struct rmnet_map_header);
   472				checksum_offset /= sizeof(u32);
   473				val |= u32_encode_bits(checksum_offset,
   474						       CS_METADATA_HDR_OFFSET_FMASK);
   475	
   476				enabled = version < IPA_VERSION_4_5
   477						? IPA_CS_OFFLOAD_UL
 > 478						: IPA_CS_OFFLOAD_INLINE;
   479			} else {
   480				enabled = version < IPA_VERSION_4_5
   481						? IPA_CS_OFFLOAD_DL
   482						: IPA_CS_OFFLOAD_INLINE;
   483			}
   484		} else {
   485			enabled = IPA_CS_OFFLOAD_NONE;
   486		}
   487		val |= u32_encode_bits(enabled, CS_OFFLOAD_EN_FMASK);
   488		/* CS_GEN_QMB_MASTER_SEL is 0 */
   489	
   490		iowrite32(val, endpoint->ipa->reg_virt + offset);
   491	}
   492	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

* [linux-next:master 6165/12612] drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
@ 2021-06-23 17:03 ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-06-23 17:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2504 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d61c8b66c84080ecf8f9f4d9272ab4ec78029a59
commit: 5567d4d9e7381230462a564d4f466177f3ba9dd5 [6165/12612] net: ipa: add support for inline checksum offload
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)
>> drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
        : IPA_CS_OFFLOAD_INLINE;
        ^

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> net/sctp/socket.c:6135:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
     to += addrlen;
     ^
>> net/sctp/socket.c:6137:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg]
     space_left -= addrlen;
     ^

vim +478 drivers/net/ipa/ipa_endpoint.c

   456	
   457	static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint)
   458	{
   459		u32 offset = IPA_REG_ENDP_INIT_CFG_N_OFFSET(endpoint->endpoint_id);
   460		enum ipa_cs_offload_en enabled;
   461		u32 val = 0;
   462	
   463		/* FRAG_OFFLOAD_EN is 0 */
   464		if (endpoint->data->checksum) {
   465			enum ipa_version version = endpoint->ipa->version;
   466	
   467			if (endpoint->toward_ipa) {
   468				u32 checksum_offset;
   469	
   470				/* Checksum header offset is in 4-byte units */
   471				checksum_offset = sizeof(struct rmnet_map_header);
   472				checksum_offset /= sizeof(u32);
   473				val |= u32_encode_bits(checksum_offset,
   474						       CS_METADATA_HDR_OFFSET_FMASK);
   475	
   476				enabled = version < IPA_VERSION_4_5
   477						? IPA_CS_OFFLOAD_UL
 > 478						: IPA_CS_OFFLOAD_INLINE;
   479			} else {
   480				enabled = version < IPA_VERSION_4_5
   481						? IPA_CS_OFFLOAD_DL
   482						: IPA_CS_OFFLOAD_INLINE;
   483			}
   484		} else {
   485			enabled = IPA_CS_OFFLOAD_NONE;
   486		}
   487		val |= u32_encode_bits(enabled, CS_OFFLOAD_EN_FMASK);
   488		/* CS_GEN_QMB_MASTER_SEL is 0 */
   489	
   490		iowrite32(val, endpoint->ipa->reg_virt + offset);
   491	}
   492	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

* Re: [linux-next:master 6165/12612] drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
  2021-06-23 17:03 ` kernel test robot
@ 2021-06-23 18:15   ` Alex Elder
  -1 siblings, 0 replies; 4+ messages in thread
From: Alex Elder @ 2021-06-23 18:15 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, Linux Memory Management List

On 6/23/21 12:03 PM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   d61c8b66c84080ecf8f9f4d9272ab4ec78029a59
> commit: 5567d4d9e7381230462a564d4f466177f3ba9dd5 [6165/12612] net: ipa: add support for inline checksum offload
> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> cppcheck warnings: (new ones prefixed by >>)
>>> drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
>          : IPA_CS_OFFLOAD_INLINE;
>          ^

Here is the full expression:

                         enabled = version < IPA_VERSION_4_5
                                         ? IPA_CS_OFFLOAD_UL
                                         : IPA_CS_OFFLOAD_INLINE;

The *value* of IPA_CS_OFFLOAD_UL *happens to be* the same
as IPA_CS_OFFLOAD_INLINE, but they represent distinct things.
The code is doing what it's doing very intentionally.

I would like to avoid being reminded of this "problem" in
the future, but I don't expect replying to the robot is
the way to do that.

Anyone have a suggestion?  Am I fine if I simply ignore this?

					-Alex

> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
> 
>>> net/sctp/socket.c:6135:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
>       to += addrlen;
>       ^
>>> net/sctp/socket.c:6137:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg]
>       space_left -= addrlen;
>       ^
> 
> vim +478 drivers/net/ipa/ipa_endpoint.c
> 
>     456	
>     457	static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint)
>     458	{
>     459		u32 offset = IPA_REG_ENDP_INIT_CFG_N_OFFSET(endpoint->endpoint_id);
>     460		enum ipa_cs_offload_en enabled;
>     461		u32 val = 0;
>     462	
>     463		/* FRAG_OFFLOAD_EN is 0 */
>     464		if (endpoint->data->checksum) {
>     465			enum ipa_version version = endpoint->ipa->version;
>     466	
>     467			if (endpoint->toward_ipa) {
>     468				u32 checksum_offset;
>     469	
>     470				/* Checksum header offset is in 4-byte units */
>     471				checksum_offset = sizeof(struct rmnet_map_header);
>     472				checksum_offset /= sizeof(u32);
>     473				val |= u32_encode_bits(checksum_offset,
>     474						       CS_METADATA_HDR_OFFSET_FMASK);
>     475	
>     476				enabled = version < IPA_VERSION_4_5
>     477						? IPA_CS_OFFLOAD_UL
>   > 478						: IPA_CS_OFFLOAD_INLINE;
>     479			} else {
>     480				enabled = version < IPA_VERSION_4_5
>     481						? IPA_CS_OFFLOAD_DL
>     482						: IPA_CS_OFFLOAD_INLINE;
>     483			}
>     484		} else {
>     485			enabled = IPA_CS_OFFLOAD_NONE;
>     486		}
>     487		val |= u32_encode_bits(enabled, CS_OFFLOAD_EN_FMASK);
>     488		/* CS_GEN_QMB_MASTER_SEL is 0 */
>     489	
>     490		iowrite32(val, endpoint->ipa->reg_virt + offset);
>     491	}
>     492	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 



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

* Re: [linux-next:master 6165/12612] drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
@ 2021-06-23 18:15   ` Alex Elder
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Elder @ 2021-06-23 18:15 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3349 bytes --]

On 6/23/21 12:03 PM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   d61c8b66c84080ecf8f9f4d9272ab4ec78029a59
> commit: 5567d4d9e7381230462a564d4f466177f3ba9dd5 [6165/12612] net: ipa: add support for inline checksum offload
> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> cppcheck warnings: (new ones prefixed by >>)
>>> drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
>          : IPA_CS_OFFLOAD_INLINE;
>          ^

Here is the full expression:

                         enabled = version < IPA_VERSION_4_5
                                         ? IPA_CS_OFFLOAD_UL
                                         : IPA_CS_OFFLOAD_INLINE;

The *value* of IPA_CS_OFFLOAD_UL *happens to be* the same
as IPA_CS_OFFLOAD_INLINE, but they represent distinct things.
The code is doing what it's doing very intentionally.

I would like to avoid being reminded of this "problem" in
the future, but I don't expect replying to the robot is
the way to do that.

Anyone have a suggestion?  Am I fine if I simply ignore this?

					-Alex

> cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
> 
>>> net/sctp/socket.c:6135:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
>       to += addrlen;
>       ^
>>> net/sctp/socket.c:6137:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg]
>       space_left -= addrlen;
>       ^
> 
> vim +478 drivers/net/ipa/ipa_endpoint.c
> 
>     456	
>     457	static void ipa_endpoint_init_cfg(struct ipa_endpoint *endpoint)
>     458	{
>     459		u32 offset = IPA_REG_ENDP_INIT_CFG_N_OFFSET(endpoint->endpoint_id);
>     460		enum ipa_cs_offload_en enabled;
>     461		u32 val = 0;
>     462	
>     463		/* FRAG_OFFLOAD_EN is 0 */
>     464		if (endpoint->data->checksum) {
>     465			enum ipa_version version = endpoint->ipa->version;
>     466	
>     467			if (endpoint->toward_ipa) {
>     468				u32 checksum_offset;
>     469	
>     470				/* Checksum header offset is in 4-byte units */
>     471				checksum_offset = sizeof(struct rmnet_map_header);
>     472				checksum_offset /= sizeof(u32);
>     473				val |= u32_encode_bits(checksum_offset,
>     474						       CS_METADATA_HDR_OFFSET_FMASK);
>     475	
>     476				enabled = version < IPA_VERSION_4_5
>     477						? IPA_CS_OFFLOAD_UL
>   > 478						: IPA_CS_OFFLOAD_INLINE;
>     479			} else {
>     480				enabled = version < IPA_VERSION_4_5
>     481						? IPA_CS_OFFLOAD_DL
>     482						: IPA_CS_OFFLOAD_INLINE;
>     483			}
>     484		} else {
>     485			enabled = IPA_CS_OFFLOAD_NONE;
>     486		}
>     487		val |= u32_encode_bits(enabled, CS_OFFLOAD_EN_FMASK);
>     488		/* CS_GEN_QMB_MASTER_SEL is 0 */
>     489	
>     490		iowrite32(val, endpoint->ipa->reg_virt + offset);
>     491	}
>     492	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> 

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

end of thread, other threads:[~2021-06-23 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 17:03 [linux-next:master 6165/12612] drivers/net/ipa/ipa_endpoint.c:478:6: warning: Same value in both branches of ternary operator. [duplicateValueTernary] kernel test robot
2021-06-23 17:03 ` kernel test robot
2021-06-23 18:15 ` Alex Elder
2021-06-23 18:15   ` Alex Elder

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.