From: Dan Carpenter <dan.carpenter@linaro.org>
To: Angela Czubak <aczubak@google.com>
Cc: linux-input@vger.kernel.org
Subject: [bug report] HID: haptic: initialize haptic device
Date: Thu, 18 Sep 2025 12:46:54 +0300 [thread overview]
Message-ID: <aMvVDjG-80rVMkz0@stanley.mountain> (raw)
Hello Angela Czubak,
Commit 344ff3584957 ("HID: haptic: initialize haptic device") from
Aug 18, 2025 (linux-next), leads to the following Smatch static
checker warning:
drivers/hid/hid-haptic.c:193 fill_effect_buf()
error: uninitialized symbol 'value'.
drivers/hid/hid-haptic.c
147 static void fill_effect_buf(struct hid_haptic_device *haptic,
148 struct ff_haptic_effect *effect,
149 struct hid_haptic_effect *haptic_effect,
150 int waveform_ordinal)
151 {
152 struct hid_report *rep = haptic->manual_trigger_report;
153 struct hid_usage *usage;
154 struct hid_field *field;
155 s32 value;
156 int i, j;
157 u8 *buf = haptic_effect->report_buf;
158
159 mutex_lock(&haptic->manual_trigger_mutex);
160 for (i = 0; i < rep->maxfield; i++) {
161 field = rep->field[i];
162 /* Ignore if report count is out of bounds. */
163 if (field->report_count < 1)
164 continue;
165
166 for (j = 0; j < field->maxusage; j++) {
167 usage = &field->usage[j];
168
169 switch (usage->hid) {
170 case HID_HP_INTENSITY:
171 if (effect->intensity > 100) {
172 value = field->logical_maximum;
173 } else {
174 value = field->logical_minimum +
175 effect->intensity *
176 (field->logical_maximum -
177 field->logical_minimum) / 100;
178 }
179 break;
180 case HID_HP_REPEATCOUNT:
181 value = effect->repeat_count;
182 break;
183 case HID_HP_RETRIGGERPERIOD:
184 value = effect->retrigger_period;
185 break;
186 case HID_HP_MANUALTRIGGER:
187 value = waveform_ordinal;
188 break;
189 default:
190 break;
value is not set on the default path.
191 }
192
--> 193 field->value[j] = value;
194 }
195 }
196
197 hid_output_report(rep, buf);
198 mutex_unlock(&haptic->manual_trigger_mutex);
199 }
regards,
dan carpenter
next reply other threads:[~2025-09-18 9:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 9:46 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-09-18 7:18 [bug report] HID: haptic: initialize haptic device Dan Carpenter
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=aMvVDjG-80rVMkz0@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=aczubak@google.com \
--cc=linux-input@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox