forked from len0rd/rockbox
Don't return pointer to array allocated on the stack
It will be out of scope once the function is left. cppcheck reported: [firmware/drivers/rtc/rtc_zenvisionm.c:31]: (error) Pointer to local array variable returned. [firmware/drivers/rtc/rtc_zenvisionm.c:38]: (error) Pointer to local array variable returned. Change-Id: Ibf28ba9b3d20cadcaff22398e143488c86746660
This commit is contained in:
parent
a71603b4d1
commit
1212edd352
1 changed files with 4 additions and 4 deletions
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
unsigned char* rtc_send_command(short unk1, short unk2)
|
unsigned char* rtc_send_command(short unk1, short unk2)
|
||||||
{
|
{
|
||||||
unsigned char ret[12];
|
static unsigned char ret[12];
|
||||||
i2c_write(I2C_ADDRESS, (unk2 & 0xFF) | (unk << 8), 1);
|
i2c_write(I2C_ADDRESS, (unk2 & 0xFF) | (unk << 8), 1);
|
||||||
i2c_read(I2C_ADDRESS, ret, 12);
|
i2c_read(I2C_ADDRESS, ret, 12);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
unsigned char* rtc_read(void)
|
unsigned char* rtc_read(void)
|
||||||
{
|
{
|
||||||
unsigned char ret[12];
|
static unsigned char ret[12];
|
||||||
i2c_read(I2C_ADDRESS, ret, 12);
|
i2c_read(I2C_ADDRESS, ret, 12);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue