* re: [media] dib7090: add the reference board TFE7090E
@ 2011-11-29 7:21 Dan Carpenter
2011-12-06 10:13 ` Olivier Grenie
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2011-11-29 7:21 UTC (permalink / raw)
To: olivier.grenie; +Cc: linux-media
Hello Olivier Grenie,
This is a semi-automatic email about new static checker warnings.
The patch 6724a2f4f7a6: "[media] dib7090: add the reference board
TFE7090E" from Aug 5, 2011, leads to the following Smatch complaint:
drivers/media/dvb/frontends/dib0090.c +1146 dib0090_pwm_gain_reset()
error: we previously assumed 'state->rf_ramp' could be null (see line 1110)
drivers/media/dvb/frontends/dib0090.c
1109 if (state->config->is_dib7090e) {
1110 if (state->rf_ramp == NULL)
^^^^^^^^^^^^^^
This test is new.
1111 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_7090e_sensitivity);
1112 else
1113 dib0090_set_rframp_pwm(state, state->rf_ramp);
1114 } else
1115 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_7090);
1116 }
1117 } else {
1118 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband);
1119 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal);
1120 }
1121 } else
1122 #endif
1123 #ifdef CONFIG_BAND_VHF
1124 if (state->current_band == BAND_VHF) {
1125 if (state->identity.in_soc) {
1126 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal_socs);
1127 } else {
1128 dib0090_set_rframp_pwm(state, rf_ramp_pwm_vhf);
1129 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal);
1130 }
1131 } else
1132 #endif
1133 {
1134 if (state->identity.in_soc) {
1135 if (state->identity.version == SOC_8090_P1G_11R1 || state->identity.version == SOC_8090_P1G_21R1)
1136 dib0090_set_rframp_pwm(state, rf_ramp_pwm_uhf_8090);
1137 else if (state->identity.version == SOC_7090_P1G_11R1 || state->identity.version == SOC_7090_P1G_21R1)
1138 dib0090_set_rframp_pwm(state, rf_ramp_pwm_uhf_7090);
1139 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal_socs);
1140 } else {
1141 dib0090_set_rframp_pwm(state, rf_ramp_pwm_uhf);
1142 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal);
1143 }
1144 }
1145
1146 if (state->rf_ramp[0] != 0)
^^^^^^^^^^^^^^^^^
This is the old dereference.
1147 dib0090_write_reg(state, 0x32, (3 << 11));
1148 else
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [media] dib7090: add the reference board TFE7090E
2011-11-29 7:21 [media] dib7090: add the reference board TFE7090E Dan Carpenter
@ 2011-12-06 10:13 ` Olivier Grenie
2011-12-06 11:00 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Olivier Grenie @ 2011-12-06 10:13 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-media@vger.kernel.org
Dear Dan,
Indeed, after the "if (state->rf_ramp == NULL)" test, the function dib0090_set_rframp_pwm will set the state->rf_ramp. So after this line, state->rf_ramp can not be NULL.
But I can make a patch in order to make sure that this code will not be detected as an error.
Regards,
Olivier
-----Original Message-----
From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
Sent: Tuesday, November 29, 2011 8:22 AM
To: Olivier Grenie
Cc: linux-media@vger.kernel.org
Subject: re: [media] dib7090: add the reference board TFE7090E
Hello Olivier Grenie,
This is a semi-automatic email about new static checker warnings.
The patch 6724a2f4f7a6: "[media] dib7090: add the reference board
TFE7090E" from Aug 5, 2011, leads to the following Smatch complaint:
drivers/media/dvb/frontends/dib0090.c +1146 dib0090_pwm_gain_reset()
error: we previously assumed 'state->rf_ramp' could be null (see line 1110)
drivers/media/dvb/frontends/dib0090.c
1109 if (state->config->is_dib7090e) {
1110 if (state->rf_ramp == NULL)
^^^^^^^^^^^^^^
This test is new.
1111 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_7090e_sensitivity);
1112 else
1113 dib0090_set_rframp_pwm(state, state->rf_ramp);
1114 } else
1115 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband_7090);
1116 }
1117 } else {
1118 dib0090_set_rframp_pwm(state, rf_ramp_pwm_cband);
1119 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal);
1120 }
1121 } else
1122 #endif
1123 #ifdef CONFIG_BAND_VHF
1124 if (state->current_band == BAND_VHF) {
1125 if (state->identity.in_soc) {
1126 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal_socs);
1127 } else {
1128 dib0090_set_rframp_pwm(state, rf_ramp_pwm_vhf);
1129 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal);
1130 }
1131 } else
1132 #endif
1133 {
1134 if (state->identity.in_soc) {
1135 if (state->identity.version == SOC_8090_P1G_11R1 || state->identity.version == SOC_8090_P1G_21R1)
1136 dib0090_set_rframp_pwm(state, rf_ramp_pwm_uhf_8090);
1137 else if (state->identity.version == SOC_7090_P1G_11R1 || state->identity.version == SOC_7090_P1G_21R1)
1138 dib0090_set_rframp_pwm(state, rf_ramp_pwm_uhf_7090);
1139 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal_socs);
1140 } else {
1141 dib0090_set_rframp_pwm(state, rf_ramp_pwm_uhf);
1142 dib0090_set_bbramp_pwm(state, bb_ramp_pwm_normal);
1143 }
1144 }
1145
1146 if (state->rf_ramp[0] != 0)
^^^^^^^^^^^^^^^^^
This is the old dereference.
1147 dib0090_write_reg(state, 0x32, (3 << 11));
1148 else
regards,
dan carpenter
CONFIDENTIAL NOTICE: The contents of this message, including any attachments, are confidential and are intended solely for the use of the person or entity to whom the message was addressed. If you are not the intended recipient of this message, please be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. If you received this message in error, please notify the sender. Please also permanently delete all copies of the original message and any attached documentation. Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [media] dib7090: add the reference board TFE7090E
2011-12-06 10:13 ` Olivier Grenie
@ 2011-12-06 11:00 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-12-06 11:00 UTC (permalink / raw)
To: Olivier Grenie; +Cc: linux-media@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
On Tue, Dec 06, 2011 at 11:13:19AM +0100, Olivier Grenie wrote:
> Dear Dan,
> Indeed, after the "if (state->rf_ramp == NULL)" test, the function
> dib0090_set_rframp_pwm will set the state->rf_ramp. So after this
> line, state->rf_ramp can not be NULL.
>
Ah right. I should have seen that myself.
> But I can make a patch in order to make sure that this code will
> not be detected as an error.
Don't do that if you don't want to. This is fixable on the static
checker side of things.
regards,
dan carpenter
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-06 11:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-29 7:21 [media] dib7090: add the reference board TFE7090E Dan Carpenter
2011-12-06 10:13 ` Olivier Grenie
2011-12-06 11:00 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).