jhd1313m1: fix potential reference of uninitialized memory

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson 2016-10-25 16:53:00 -06:00
parent 370d43d1b3
commit 654c3be71e

View File

@ -43,6 +43,8 @@ jhd1313m1_context jhd1313m1_init(int bus, int lcd_addr, int rgb_addr)
if (!dev)
return NULL;
memset((void *)dev, 0, sizeof(struct _jhd1313m1_context));
// make sure MRAA is initialized
int mraa_rv;
if ((mraa_rv = mraa_init()) != MRAA_SUCCESS)
@ -52,8 +54,6 @@ jhd1313m1_context jhd1313m1_init(int bus, int lcd_addr, int rgb_addr)
return NULL;
}
memset((void *)dev, 0, sizeof(struct _jhd1313m1_context));
// initialize the MRAA contexts
if (!(dev->i2cLCD = mraa_i2c_init(bus)))