[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2E89032DDAA8B9408CB92943514A0337014C1E284C@SW-EX-MBX01.diasemi.com>
Date: Thu, 22 Mar 2018 09:37:44 +0000
From: Adam Thomson <Adam.Thomson.Opensource@...semi.com>
To: Guenter Roeck <linux@...ck-us.net>,
Adam Thomson <Adam.Thomson.Opensource@...semi.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sebastian Reichel <sre@...nel.org>,
"Hans de Goede" <hdegoede@...hat.com>, Jun Li <jun.li@....com>
CC: "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Support Opensource" <Support.Opensource@...semi.com>
Subject: RE: [PATCH v5 5/5] typec: tcpm: Add support for sink PPS related
messages
On 22 March 2018 03:53, Guenter Roeck wrote:
> > +static void tcpm_pd_ext_msg_request(struct tcpm_port *port,
> > + const struct pd_message *msg)
> > +{
> > + enum pd_ext_msg_type type = pd_header_type_le(msg->header);
> > + unsigned int data_size = pd_ext_header_data_size_le(msg-
> >ext_msg.header);
> > + u8 *data;
> > +
> > + if (!(msg->ext_msg.header && PD_EXT_HDR_CHUNKED)) {
> > + tcpm_log(port, "Unchunked extended messages unsupported");
> > + return;
> > + }
> > +
> > + if (data_size > (PD_EXT_MAX_CHUNK_DATA)) {
> > + tcpm_log(port, "Chunk handling not yet supported");
> > + return;
> > + }
> > +
> > + data = kzalloc(data_size, GFP_KERNEL);
> > + if (!data) {
> > + tcpm_log(port, "Failed to allocate memory for ext msg data");
> > + return;
> > + }
> > + memcpy(data, msg->ext_msg.data, data_size);
> > +
> > + switch (type) {
> > + case PD_EXT_STATUS:
> > + /*
> > + * If PPS related events raised then get PPS status to clear
> > + * (see USB PD 3.0 Spec, 6.5.2.4)
> > + */
> > + if (data[USB_PD_EXT_SDB_EVENT_FLAGS] &
> USB_PD_EXT_SDB_PPS_EVENTS)
>
> This seems to be the only use of 'data'. Can you explain why it is needed
> in the first place ? Am I missing something ?
Actually it's a fair point. Right now it's not needed so will remove it and
directly reference the ext_msg.data array.
Powered by blists - more mailing lists