Commit ab87117
iio: chemical: sunrise_co2: set val parameter only on success
[ Upstream commit 38ac2f0 ]
Clang static analysis reports this representative warning
sunrise_co2.c:410:9: warning: Assigned value is garbage or undefined
*val = value;
^ ~~~~~
The ealier call to sunrise_read_word can fail without setting
value. So defer setting val until we know the read was successful.
Fixes: c397894 ("iio: chemical: Add Senseair Sunrise 006-0-007 driver")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20211224150833.3278236-1-trix@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 41bd136 commit ab87117
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
411 | 410 | | |
412 | 411 | | |
413 | 412 | | |
414 | 413 | | |
415 | 414 | | |
| 415 | + | |
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
423 | 422 | | |
424 | 423 | | |
425 | 424 | | |
426 | 425 | | |
427 | 426 | | |
| 427 | + | |
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| |||
0 commit comments