From: Dan Carpenter <dan.carpenter@oracle.com>
To: sandeep.singh@amd.com
Cc: linux-input@vger.kernel.org
Subject: [bug report] SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)
Date: Mon, 2 Nov 2020 17:01:47 +0300 [thread overview]
Message-ID: <20201102140147.GA41810@mwanda> (raw)
Hello Sandeep Singh,
The patch 4b2c53d93a4b: "SFH:Transport Driver to add support of AMD
Sensor Fusion Hub (SFH)" from Oct 10, 2020, leads to the following
static checker warning:
drivers/hid/amd-sfh-hid/amd_sfh_client.c:222 amd_sfh_hid_client_init()
warn: '&cl_data->work.timer' not released on lines: 202,222.
drivers/hid/amd-sfh-hid/amd_sfh_client.c
134 int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
135 {
136 struct amdtp_cl_data *cl_data = privdata->cl_data;
137 struct amd_mp2_sensor_info info;
138 struct device *dev;
139 u32 feature_report_size;
140 u32 input_report_size;
141 u8 cl_idx;
142 int rc, i;
143
144 dev = &privdata->pdev->dev;
145 cl_data = kzalloc(sizeof(*cl_data), GFP_KERNEL);
146 if (!cl_data)
147 return -ENOMEM;
148
149 cl_data->num_hid_devices = amd_mp2_get_sensor_num(privdata, &cl_data->sensor_idx[0]);
150
151 INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work);
152 INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer);
I think the INIT_DELAYED_WORK() allocates a bunch of debug stuff but I'm
not 100% positive... Maybe there is nothing to free. Does anyone know?
153 INIT_LIST_HEAD(&req_list.list);
154
155 for (i = 0; i < cl_data->num_hid_devices; i++) {
156 cl_data->sensor_virt_addr[i] = dma_alloc_coherent(dev, sizeof(int) * 8,
157 &cl_data->sensor_phys_addr[i],
158 GFP_KERNEL);
159 cl_data->sensor_sts[i] = 0;
160 cl_data->sensor_requested_cnt[i] = 0;
161 cl_data->cur_hid_dev = i;
162 cl_idx = cl_data->sensor_idx[i];
163 cl_data->report_descr_sz[i] = get_descr_sz(cl_idx, descr_size);
164 if (!cl_data->report_descr_sz[i]) {
165 rc = -EINVAL;
166 goto cleanup;
167 }
168 feature_report_size = get_descr_sz(cl_idx, feature_size);
169 if (!feature_report_size) {
170 rc = -EINVAL;
171 goto cleanup;
172 }
173 input_report_size = get_descr_sz(cl_idx, input_size);
174 if (!input_report_size) {
175 rc = -EINVAL;
176 goto cleanup;
177 }
178 cl_data->feature_report[i] = kzalloc(feature_report_size, GFP_KERNEL);
179 if (!cl_data->feature_report[i]) {
180 rc = -ENOMEM;
181 goto cleanup;
182 }
183 cl_data->input_report[i] = kzalloc(input_report_size, GFP_KERNEL);
184 if (!cl_data->input_report[i]) {
185 rc = -ENOMEM;
186 goto cleanup;
187 }
188 info.period = msecs_to_jiffies(AMD_SFH_IDLE_LOOP);
189 info.sensor_idx = cl_idx;
190 info.phys_address = cl_data->sensor_phys_addr[i];
191
192 cl_data->report_descr[i] = kzalloc(cl_data->report_descr_sz[i], GFP_KERNEL);
193 if (!cl_data->report_descr[i]) {
194 rc = -ENOMEM;
195 goto cleanup;
196 }
197 rc = get_report_descriptor(cl_idx, cl_data->report_descr[i]);
198 if (rc)
199 return rc;
^^^^^^^^^^
This should "goto cleanup"
200 rc = amdtp_hid_probe(cl_data->cur_hid_dev, cl_data);
201 if (rc)
202 return rc;
^^^^^^^^^^
Same
203 amd_start_sensor(privdata, info);
204 cl_data->sensor_sts[i] = 1;
205 }
206 privdata->cl_data = cl_data;
207 schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP));
208 return 0;
209
210 cleanup:
211 for (i = 0; i < cl_data->num_hid_devices; i++) {
212 if (cl_data->sensor_virt_addr[i]) {
213 dma_free_coherent(&privdata->pdev->dev, 8 * sizeof(int),
214 cl_data->sensor_virt_addr[i],
215 cl_data->sensor_phys_addr[i]);
216 }
217 kfree(cl_data->feature_report[i]);
218 kfree(cl_data->input_report[i]);
219 kfree(cl_data->report_descr[i]);
220 }
221 kfree(cl_data);
222 return rc;
223 }
regards,
dan carpenter
reply other threads:[~2020-11-02 14:03 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=20201102140147.GA41810@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-input@vger.kernel.org \
--cc=sandeep.singh@amd.com \
/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.