alpine 3.7
obsolete weakness #19

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

xf86-video-openchrome/src/xf86-video-openchrome-0.6.0/src/via_ch7xxx.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.7 obsolete weakness.

 		W_Buffer[1] = 0x20;
		xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0);

		for (i = 0; i < 10; i++) {
			W_Buffer[0] = 0x63;
			xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1);
			usleep(100);
			W_Buffer[0] = 0x63;
			W_Buffer[1] = (R_Buffer[0] | 0x40);
			xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0);
			DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                             "CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
			usleep(1);
			W_Buffer[0] = 0x63;
			W_Buffer[1] &= ~0x40;
			xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0);
			DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                             "CH7xxxLCDPower: [%d]write 0x63 = %X!\n", i+1, W_Buffer[1]));
			usleep(100);
			W_Buffer[0] = 0x66;
			xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1);

			if (((R_Buffer[0] & 0x44) == 0x44) || (i >= 9)) {
				/* PLL lock OK, Turn on VDD */
				usleep(500);
				W_Buffer[1] = R_Buffer[0] | 0x01;
				xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0);
				DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
						 "CH7xxxLCDPower: CH7019 PLL lock ok!\n"));
				/* reset data path */
				W_Buffer[0] = 0x48;
				xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1);
				W_Buffer[1] = R_Buffer[0] & ~0x08;
				xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0);
				usleep(1);
				W_Buffer[1] = R_Buffer[0];
				xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,2, NULL,0);
				break;
			}

            DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                             "CH7xxxLCDPower: [%d]CH7019 PLL lock fail!\n", i+1));
            DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                             "CH7xxxLCDPower: [%d]0x66 = %X!\n", i+1, R_Buffer[0]));
		}
	}else{
		DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CH7xxxLCDPower: Off\n"));
		/* Turn off VDD (Turn off backlignt only) */
		W_Buffer[0] = 0x66;
		xf86I2CWriteRead(pBIOSInfo->TVI2CDev, W_Buffer,1, R_Buffer,1); 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.