pwm: Check for out of range pin number in pwm_init()
Signed-off-by: Henry Bruce <henry.bruce@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
c86fe2a12b
commit
078218f680
@@ -186,6 +186,10 @@ mraa_pwm_init(int pin)
|
|||||||
syslog(LOG_NOTICE, "pwm: Using sub platform is not supported");
|
syslog(LOG_NOTICE, "pwm: Using sub platform is not supported");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (pin < 0 || pin > plat->phy_pin_count) {
|
||||||
|
syslog(LOG_ERR, "pwm: pin %i beyond platform definition", pin);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (plat->pins[pin].capabilites.pwm != 1) {
|
if (plat->pins[pin].capabilites.pwm != 1) {
|
||||||
syslog(LOG_ERR, "pwm: pin not capable of pwm");
|
syslog(LOG_ERR, "pwm: pin not capable of pwm");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user