Search Linux Wireless

Re: [PATCH 02/43] iwlwifi: mvm: add registration to thermal zone

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

 



Bjørn Mork <bjorn@xxxxxxx> writes:

>> +static void iwl_mvm_thermal_zone_unregister(struct iwl_mvm *mvm)
>> +{
>> +	if (!iwl_mvm_is_tt_in_fw(mvm))
>> +		return;
>> +
>> +	if (mvm->tz_device.tzone) {
>> +		IWL_DEBUG_TEMP(mvm, "Thermal zone device unregister\n");
>> +		thermal_zone_device_unregister(mvm->tz_device.tzone);
>
> Won't that ERR_PTR blow up when dereferenced by
> thermal_zone_device_unregister() ?

To answer myself:  No, it won't.  I was tricked by the oddly placed
  tzp = tz->tzp;
line here, but we will return before that becomes a problem:

void thermal_zone_device_unregister(struct thermal_zone_device *tz)
{
        int i;
        const struct thermal_zone_params *tzp;
        struct thermal_cooling_device *cdev;
        struct thermal_zone_device *pos = NULL;

        if (!tz)
                return;

        tzp = tz->tzp;

        mutex_lock(&thermal_list_lock);
        list_for_each_entry(pos, &thermal_tz_list, node)
            if (pos == tz)
                break;
        if (pos != tz) {
                /* thermal zone device not found */
                mutex_unlock(&thermal_list_lock);
                return;
        }


Still think it's unwise to leave ERR_PTR's around though.



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



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux