Re: [PATCH] PM / Hibernate : Use get_gendisk to verify partition ifresume_file is integer format

From: Minho Ban
Date: Sun May 13 2012 - 20:53:07 EST


On 05/13/2012 06:39 AM, Rafael J. Wysocki wrote:
> On Wednesday, May 09, 2012, Minho Ban wrote:
>> /* Check if the device is there */
>> swsusp_resume_device = name_to_dev_t(resume_file);
>> +
>> + /*
>> + * name_to_dev_t is ineffective to verify parition if resume_file is in
>> + * integer format. (e.g. major:minor)
>> + */
>> + if (isdigit(resume_file[0]) && resume_wait) {
>> + int partno;
>> + while (!get_gendisk(swsusp_resume_device, &partno))
>> + msleep(10);
>> + }
>
> Hmm. Wouldn't it be better to do:
>
> if (isdigit(resume_file[0]) && resume_wait) {
> int partno;
> while (!get_gendisk(swsusp_resume_device, &partno))
> msleep(10);
> } else {
> swsusp_resume_device = name_to_dev_t(resume_file);
> }
>
> ?

Do you want name_to_dev_t to be called again? If not, swsusp_resume_device parameter
in get_gendisk can not be used because it is not initialized yet.

>
> Your new code will overwrite whatever swsusp_resume_device is set to by the
> preceding statement anyway.
>

Sorry, I don't understand what will be overwritten by the new code. It would be very
much appreciated if you point it again.

Regards,
Minho Ban
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/