treewide: Fix code issues detected using GCC 8.2.0

Use the latest version of GCC to take advantage of improved static analysis.
These issues appeared as warnings from the compiler.

Many of these fixes are for clearly incorrect code; compiler warnings
should not be taken lightly.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2018-08-11 18:13:12 -07:00 committed by Timi
parent 7d9b389db3
commit 6b791ecbcd
13 changed files with 40 additions and 51 deletions

View file

@ -4678,7 +4678,7 @@ again:
pce_dev->intr_cadence = 0;
atomic_set(&pce_dev->bunch_cmd_seq, 0);
atomic_set(&pce_dev->last_intr_seq, 0);
pce_dev->cadence_flag = ~pce_dev->cadence_flag;
pce_dev->cadence_flag = !pce_dev->cadence_flag;
}
}

View file

@ -2630,11 +2630,12 @@ static int qpnp_wled_probe(struct platform_device *pdev)
wled = devm_kzalloc(&pdev->dev, sizeof(*wled), GFP_KERNEL);
if (!wled)
return -ENOMEM;
wled->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!wled->regmap) {
dev_err(&pdev->dev, "Couldn't get parent's regmap\n");
return -EINVAL;
}
wled->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!wled->regmap) {
dev_err(&pdev->dev, "Couldn't get parent's regmap\n");
return -EINVAL;
}
wled->pdev = pdev;

View file

@ -171,8 +171,6 @@ static int32_t msm_vfe40_init_qos_parms(struct vfe_device *vfe_dev,
qos_regs, qos_entries);
if (rc < 0) {
pr_err("%s: NO QOS BUS BDG info\n", __func__);
kfree(qos_settings);
kfree(qos_regs);
} else {
if (qos_parms->settings) {
rc = of_property_read_u32_array(of_node,
@ -181,20 +179,15 @@ static int32_t msm_vfe40_init_qos_parms(struct vfe_device *vfe_dev,
if (rc < 0) {
pr_err("%s: NO QOS settings\n",
__func__);
kfree(qos_settings);
kfree(qos_regs);
} else {
for (i = 0; i < qos_entries; i++)
msm_camera_io_w(qos_settings[i],
vfebase + qos_regs[i]);
kfree(qos_settings);
kfree(qos_regs);
}
} else {
kfree(qos_settings);
kfree(qos_regs);
}
}
kfree(qos_settings);
kfree(qos_regs);
}
rc = of_property_read_u32(of_node, ds_parms->entries,
&ds_entries);
@ -218,8 +211,6 @@ static int32_t msm_vfe40_init_qos_parms(struct vfe_device *vfe_dev,
ds_regs, ds_entries);
if (rc < 0) {
pr_err("%s: NO D/S register info\n", __func__);
kfree(ds_settings);
kfree(ds_regs);
} else {
if (ds_parms->settings) {
rc = of_property_read_u32_array(of_node,
@ -228,20 +219,15 @@ static int32_t msm_vfe40_init_qos_parms(struct vfe_device *vfe_dev,
if (rc < 0) {
pr_err("%s: NO D/S settings\n",
__func__);
kfree(ds_settings);
kfree(ds_regs);
} else {
} else {
for (i = 0; i < ds_entries; i++)
msm_camera_io_w(ds_settings[i],
vfebase + ds_regs[i]);
kfree(ds_regs);
kfree(ds_settings);
}
} else {
kfree(ds_regs);
kfree(ds_settings);
}
}
kfree(ds_settings);
kfree(ds_regs);
}
return 0;
}

View file

@ -1349,7 +1349,7 @@ static int msm_probe(struct platform_device *pdev)
if (WARN_ON(rc < 0))
goto media_fail;
if (WARN_ON((rc == media_entity_init(&pvdev->vdev->entity,
if (WARN_ON((rc = media_entity_init(&pvdev->vdev->entity,
0, NULL, 0)) < 0))
goto entity_fail;

View file

@ -3858,17 +3858,20 @@ int msm_comm_qbuf(struct msm_vidc_inst *inst, struct vb2_buffer *vb)
* Don't queue if:
* 1) Hardware isn't ready (that's simple)
*/
defer = defer ?: inst->state != MSM_VIDC_START_DONE;
if (!defer)
defer = inst->state != MSM_VIDC_START_DONE;
/*
* 2) The client explicitly tells us not to because it wants this
* buffer to be batched with future frames. The batch size (on both
* capabilities) is completely determined by the client.
*/
defer = defer ?: vbuf && vbuf->flags & V4L2_MSM_BUF_FLAG_DEFER;
if (!defer)
defer = vbuf && vbuf->flags & V4L2_MSM_BUF_FLAG_DEFER;
/* 3) If we're in batch mode, we must have full batches of both types */
defer = defer ?: batch_mode && (!output_count || !capture_count);
if (!defer)
defer = batch_mode && (!output_count || !capture_count);
if (defer) {
dprintk(VIDC_DBG, "Deferring queue of %pK\n", vb);

View file

@ -54,7 +54,7 @@ static long audio_ioctl_shared(struct file *file, unsigned int cmd,
int rc = 0;
switch (cmd) {
case AUDIO_START: {
case AUDIO_START:
pr_err("%s[%pK]: AUDIO_START session_id[%d]\n", __func__,
audio, audio->ac->session);
if (audio->feedback == NON_TUNNEL_MODE) {
@ -104,10 +104,8 @@ static long audio_ioctl_shared(struct file *file, unsigned int cmd,
pr_debug("%s:AUDIO_START sessionid[%d]enable[%d]\n", __func__,
audio->ac->session,
audio->enabled);
if (audio->stopped == 1)
audio->stopped = 0;
break;
}
audio->stopped = 0;
break;
default:
pr_err("%s: Unknown ioctl cmd = %d", __func__, cmd);
rc = -EINVAL;

View file

@ -54,7 +54,7 @@ int __ipa_generate_rt_hw_rule_v2(enum ipa_ip_type ip,
struct ipa_hdr_entry *hdr_entry;
if (buf == NULL) {
memset(tmp, 0, (IPA_RT_FLT_HW_RULE_BUF_SIZE/4));
memset(tmp, 0, sizeof(tmp));
buf = (u8 *)tmp;
}

View file

@ -6487,11 +6487,12 @@ int cpr3_regulator_unregister(struct cpr3_controller *ctrl)
if (ctrl->irq && !cpumask_empty(&ctrl->irq_affinity_mask))
unregister_hotcpu_notifier(&ctrl->cpu_hotplug_notifier);
if (ctrl->ctrl_type == CPR_CTRL_TYPE_CPR4)
if (ctrl->ctrl_type == CPR_CTRL_TYPE_CPR4) {
rc = cpr3_ctrl_clear_cpr4_config(ctrl);
if (rc)
cpr3_err(ctrl, "failed to clear CPR4 configuration,rc=%d\n",
rc);
}
cpr3_ctrl_loop_disable(ctrl);

View file

@ -150,7 +150,6 @@ int subsys_notif_queue_notification(void *subsys_handle,
enum subsys_notif_type notif_type,
void *data)
{
int ret = 0;
struct subsys_notif_info *subsys =
(struct subsys_notif_info *) subsys_handle;
@ -160,10 +159,9 @@ int subsys_notif_queue_notification(void *subsys_handle,
if (notif_type < 0 || notif_type >= SUBSYS_NOTIF_TYPE_COUNT)
return -EINVAL;
ret = srcu_notifier_call_chain(
return srcu_notifier_call_chain(
&subsys->subsys_notif_rcvr_list, notif_type,
data);
return ret;
}
EXPORT_SYMBOL(subsys_notif_queue_notification);

View file

@ -1232,7 +1232,7 @@ static int mdss_mdp_video_wait4comp(struct mdss_mdp_ctl *ctl, void *arg)
if (rc == 0) {
pr_warn("vsync wait timeout %d, fallback to poll mode\n",
ctl->num);
ctx->polling_en++;
ctx->polling_en = true;
rc = mdss_mdp_video_pollwait(ctl);
} else {
rc = 0;

View file

@ -1321,15 +1321,15 @@ static void mdss_dsi_phy_regulator_ctrl(struct mdss_dsi_ctrl_pdata *ctrl,
mdss_dsi_20nm_phy_regulator_enable(ctrl);
break;
default:
/*
* For dual dsi case, do not reconfigure dsi phy
* regulator if the other dsi controller is still
* active.
*/
if (!mdss_dsi_is_hw_config_dual(sdata) ||
(other_ctrl && (!other_ctrl->is_phyreg_enabled
|| other_ctrl->mmss_clamp)))
mdss_dsi_28nm_phy_regulator_enable(ctrl);
/*
* For dual dsi case, do not reconfigure dsi phy
* regulator if the other dsi controller is still
* active.
*/
if (!mdss_dsi_is_hw_config_dual(sdata) ||
(other_ctrl && (!other_ctrl->is_phyreg_enabled
|| other_ctrl->mmss_clamp)))
mdss_dsi_28nm_phy_regulator_enable(ctrl);
break;
}
}

View file

@ -397,13 +397,15 @@ static bool __wcd9xxx_switch_micbias(struct wcd9xxx_mbhc *mbhc,
pr_debug("%s: VDDIO switch enabled\n", __func__);
} else if (!vddio_switch && mbhc->mbhc_micbias_switched) {
if ((!checkpolling || mbhc->polling_active) &&
restartpolling)
restartpolling) {
wcd9xxx_pause_hs_polling(mbhc);
snd_soc_update_bits(codec, WCD9XXX_A_MAD_ANA_CTRL,
0x10, 0x10);
snd_soc_update_bits(codec, WCD9XXX_A_LDO_H_MODE_1,
0x20, 0x20);
}
/* Reprogram thresholds */
if (d->micb_mv != VDDIO_MICBIAS_MV) {
cfilt_k_val =

View file

@ -496,7 +496,7 @@ static int msm_voice_sidetone_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int ret;
bool sidetone_enable = ucontrol->value.integer.value[0];
int sidetone_enable = ucontrol->value.integer.value[0];
uint32_t session_id = ALL_SESSION_VSID;
if (sidetone_enable < 0) {