Re: [PATCH v2] thermal: Add QPNP PMIC temperature alarm driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Fri, 2014-09-26 at 16:51 +0530, Kiran Padwal wrote:
> On Thursday 25 September 2014 07:00 PM, Ivan T. Ivanov wrote:
> > Add support for the temperature alarm peripheral found inside
> > Qualcomm plug-and-play (QPNP) PMIC chips.  The temperature alarm
> > peripheral outputs a pulse on an interrupt line whenever the
> > thermal over temperature stage value changes.  Implement an ISR
> > to manage this interrupt.
> > 
> 
> <snip>
> 
> > + * This function updates the internal temp value based on the
> > + * current thermal stage and threshold as well as the previous stage
> > + */
> > +static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip)
> > +{
> > +	unsigned int stage;
> > +	int rc;
> > +	u8 reg;
> > +
> > +	rc = qpnp_tm_read(chip, QPNP_TM_REG_STATUS, &reg);
> > +	if (rc < 0)
> > +		return rc;
> > +
> > +	stage = reg & STATUS_STAGE_MASK;
> 
> During compilation, getting a waring as below,
> 
> drivers/thermal/qpnp-temp-alarm.c: In function ‘qpnp_tm_update_temp_no_adc’:
> drivers/thermal/qpnp-temp-alarm.c:135:8: warning: ‘reg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   stage = reg & STATUS_STAGE_MASK;

Could you share compiler version and options which you are using.
I am unable to trigger this warning. Looking code I can not 
see how this could happen.

> 
> > +
> > +	if (stage > chip->stage) {
> > +		/* increasing stage, use lower bound */
> > +		chip->temp = (stage - 1) * TEMP_STAGE_STEP +
> > +			     chip->thresh * TEMP_THRESH_STEP +
> > +			     TEMP_STAGE_HYSTERESIS + TEMP_THRESH_MIN;
> > +	} else if (stage < chip->stage) {
> > +		/* decreasing stage, use upper bound */
> > +		chip->temp = stage * TEMP_STAGE_STEP +
> > +			     chip->thresh * TEMP_THRESH_STEP -
> > +			     TEMP_STAGE_HYSTERESIS + TEMP_THRESH_MIN;
> > +	}
> > +
> > +	chip->stage = stage;
> > +
> > +	return 0;
> > +}
> > +
> 
> <snip>
> 
> > +
> > +#define QPNP_TM_PM_OPS	(&qpnp_tm_pm_ops)
> > +#else
> > +#define QPNP_TM_PM_OPS	NULL
> > +#endif
> > +
> > +static struct of_device_id qpnp_tm_match_table[] = {
> 
> It must be static const struct of_device_id, because all OF functions handle it as const.

Sure, will fix it.

Thank you,
Ivan

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux