[U-Boot] cmd_date.c error or itention?

Reinhard Meyer (-VC) reinhard.meyer at emk-elektronik.de
Mon Jul 5 13:44:22 CEST 2010


Hi,

cmd_data.c codes the following:

	case 2:			/* set date & time */
		if (strcmp(argv[1],"reset") == 0) {
			puts ("Reset RTC...\n");
			rtc_reset ();
		} else {
			/* initialize tm with current time */
			rcode = rtc_get (&tm);

			if(!rcode) {
				/* insert new date & time */
				if (mk_date (argv[1], &tm) != 0) {
					puts ("## Bad date format\n");
					break;
				}
				/* and write to RTC */
				rcode = rtc_set (&tm);
				if(rcode)
					puts("## Set date failed\n");
			} else {
				puts("## Get date failed\n");
			}
		}
		/* FALL TROUGH */

Now I have implemented rtc_get() such that it returns an error code
when the time is corrupt/has never been set.

However the "if(!rcode)" then prevents the time to be set!

Is that intentional and rtc_get() should never return an error ??
Or is it an oversight, and a patch would be welcome ?

Reinhard



More information about the U-Boot mailing list