Re: [bug report] soc: qcom: Add APR bus driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Dan,

On 17/05/18 14:27, Dan Carpenter wrote:
Hello Srinivas Kandagatla,

The patch 6adba21eb434: "soc: qcom: Add APR bus driver" from May 9,
2018, leads to the following static checker warning:

	drivers/soc/qcom/apr.c:95 apr_callback()
	warn: always true condition '(msg_type != 69864) => (0-u16max != 69864)'

drivers/soc/qcom/apr.c
     61  static int apr_callback(struct rpmsg_device *rpdev, void *buf,
     62                                    int len, void *priv, u32 addr)
     63  {
     64          struct apr *apr = dev_get_drvdata(&rpdev->dev);
     65          uint16_t hdr_size, msg_type, ver, svc_id;
     66          struct apr_device *svc = NULL;
     67          struct apr_driver *adrv = NULL;
     68          struct apr_resp_pkt resp;
     69          struct apr_hdr *hdr;
     70          unsigned long flags;
     71
     72          if (len <= APR_HDR_SIZE) {
     73                  dev_err(apr->dev, "APR: Improper apr pkt received:%p %d\n",
     74                          buf, len);
     75                  return -EINVAL;
     76          }
     77
     78          hdr = buf;
     79          ver = APR_HDR_FIELD_VER(hdr->hdr_field);
     80          if (ver > APR_PKT_VER + 1)
     81                  return -EINVAL;
     82
     83          hdr_size = APR_HDR_FIELD_SIZE_BYTES(hdr->hdr_field);
     84          if (hdr_size < APR_HDR_SIZE) {
     85                  dev_err(apr->dev, "APR: Wrong hdr size:%d\n", hdr_size);
     86                  return -EINVAL;
     87          }
     88
     89          if (hdr->pkt_size < APR_HDR_SIZE || hdr->pkt_size != len) {
     90                  dev_err(apr->dev, "APR: Wrong paket size\n");
     91                  return -EINVAL;
     92          }
     93
     94          msg_type = APR_HDR_FIELD_MT(hdr->hdr_field);
     95          if (msg_type >= APR_MSG_TYPE_MAX && msg_type != APR_BASIC_RSP_RESULT) {
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
msg_type can't be APR_BASIC_RSP_RESULT (0x000110E8).  Perhaps there is
a typo in the define?
Yes, this is a typo. We can remove this check!
I will send a patch soon.

Thanks,
srini

     96                  dev_err(apr->dev, "APR: Wrong message type: %d\n", msg_type);
     97                  return -EINVAL;
     98          }
     99

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux