Message ID | 20180517233105.8243-3-bsingharora@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | scan build fixes | expand |
On 05/18/2018 05:01 AM, Balbir singh wrote: > Caught by scan-build, also constant-ify the input > parameter. > > Signed-off-by: Balbir singh <bsingharora@gmail.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> -Vasant > --- > hw/fsp/fsp-leds.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c > index 0fe03094..9040c0a4 100644 > --- a/hw/fsp/fsp-leds.c > +++ b/hw/fsp/fsp-leds.c > @@ -203,9 +203,12 @@ static inline void opal_led_update_complete(u64 async_token, u64 result) > opal_queue_msg(OPAL_MSG_ASYNC_COMP, NULL, NULL, async_token, result); > } > > -static inline bool is_sai_loc_code(char *loc_code) > +static inline bool is_sai_loc_code(const char *loc_code) > { > - if (!strcmp(sai_data.loc_code, loc_code)) > + if (!loc_code) > + return false; > + > + if (!strncmp(sai_data.loc_code, loc_code, strlen(sai_data.loc_code))) > return true; > > return false; >
diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c index 0fe03094..9040c0a4 100644 --- a/hw/fsp/fsp-leds.c +++ b/hw/fsp/fsp-leds.c @@ -203,9 +203,12 @@ static inline void opal_led_update_complete(u64 async_token, u64 result) opal_queue_msg(OPAL_MSG_ASYNC_COMP, NULL, NULL, async_token, result); } -static inline bool is_sai_loc_code(char *loc_code) +static inline bool is_sai_loc_code(const char *loc_code) { - if (!strcmp(sai_data.loc_code, loc_code)) + if (!loc_code) + return false; + + if (!strncmp(sai_data.loc_code, loc_code, strlen(sai_data.loc_code))) return true; return false;
Caught by scan-build, also constant-ify the input parameter. Signed-off-by: Balbir singh <bsingharora@gmail.com> --- hw/fsp/fsp-leds.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)