From: kernel test robot <lkp@intel.com>
To: cros-kernel-buildreports@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [android-common:android17-6.18 0/2] drivers/usb/typec/tcpm/tcpm.c:1685:18: sparse: sparse: incorrect type in assignment (different base types)
Date: Tue, 25 Aug 2026 17:03:33 +0800 [thread overview]
Message-ID: <202608251646.maAL5DQd-lkp@intel.com> (raw)
tree: https://android.googlesource.com/kernel/common android17-6.18
head: 108028936ad167fb2d330e9151ce744f363fb538
commit: 19fa58626d0aaa0440aa17f36ca216e23293b383 [0/2] FROMGIT: usb: typec: tcpm: Add support for Battery Cap response message
config: i386-randconfig-063-20260825 (https://download.01.org/0day-ci/archive/20260825/202608251646.maAL5DQd-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260825/202608251646.maAL5DQd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608251646.maAL5DQd-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/usb/typec/tcpm/tcpm.c:1685:18: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] vid @@ got int @@
drivers/usb/typec/tcpm/tcpm.c:1685:18: sparse: expected restricted __le16 [usertype] vid
drivers/usb/typec/tcpm/tcpm.c:1685:18: sparse: got int
vim +1685 drivers/usb/typec/tcpm/tcpm.c
1638
1639 static int tcpm_pd_send_batt_cap(struct tcpm_port *port)
1640 {
1641 u16 design_cap = BATTERY_PROPERTY_UNKNOWN;
1642 u16 charge_cap = BATTERY_PROPERTY_UNKNOWN;
1643 u32 batt_id = port->batt_request_id;
1644 union power_supply_propval val;
1645 struct batt_cap_ext_msg bcdb;
1646 struct power_supply *batt;
1647 bool invalid_ref = true;
1648 struct pd_message msg;
1649 u8 data_obj_cnt;
1650 int ret, vol;
1651
1652 tcpm_get_fixed_batt(port);
1653 memset(&msg, 0, sizeof(msg));
1654
1655 if (batt_id >= port->fixed_batt_cnt || batt_id >= MAX_NUM_FIXED_BATT)
1656 goto send_cap;
1657
1658 invalid_ref = false;
1659 batt = port->fixed_batt[batt_id];
1660 ret = power_supply_get_property(batt, POWER_SUPPLY_PROP_VOLTAGE_AVG,
1661 &val);
1662 if (!ret) {
1663 vol = val.intval;
1664 ret = power_supply_get_property(batt,
1665 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
1666 &val);
1667 if (!ret)
1668 design_cap = tcpm_charge_to_energy(val.intval, vol);
1669
1670 ret = power_supply_get_property(batt,
1671 POWER_SUPPLY_PROP_CHARGE_FULL,
1672 &val);
1673 if (!ret)
1674 charge_cap = tcpm_charge_to_energy(val.intval, vol);
1675 }
1676
1677 send_cap:
1678
1679 /*
1680 * As per the USB PD Rev3.1 v1.8 spec, if a battery VID (assigned by the
1681 * USB-IF) does not exist or an invalid battery reference is made by the
1682 * requestor, then set the VID field to 0xffff. If the VID field is
1683 * 0xffff, set the PID field to 0.
1684 */
> 1685 bcdb.vid = BATTERY_PROPERTY_UNKNOWN;
1686 bcdb.pid = 0;
1687 bcdb.batt_design_cap = cpu_to_le16(design_cap);
1688 bcdb.batt_last_chg_cap = cpu_to_le16(charge_cap);
1689 bcdb.batt_type = invalid_ref ? BATT_CAP_BATT_TYPE_INVALID_REF : 0;
1690 memcpy(msg.ext_msg.data, &bcdb, sizeof(bcdb));
1691 msg.ext_msg.header = PD_EXT_HDR_LE(sizeof(bcdb),
1692 0, /* Denotes if request chunk */
1693 0, /* Chunk number */
1694 1 /* Chunked */);
1695
1696 data_obj_cnt = count_chunked_data_objs(sizeof(bcdb));
1697 msg.header = PD_HEADER_EXT_LE(PD_EXT_BATT_CAP, port->pwr_role,
1698 port->data_role, port->negotiated_rev,
1699 port->message_id, data_obj_cnt);
1700
1701 return tcpm_pd_transmit(port, TCPC_TX_SOP, &msg);
1702 }
1703
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-08-25 9:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202608251646.maAL5DQd-lkp@intel.com \
--to=lkp@intel.com \
--cc=cros-kernel-buildreports@googlegroups.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.