drivers: dcvs: memlat: check return value of devm_protocol_get
Validate return value of devm_protocol_get. Currently only NULL pointer is checked but we should also check if returned pointer is valid pointer or not. If it is not valid pointer then it can lead to crash. Change-Id: If7c6e275bae0df42511cc915215bfe434d2053e3 Signed-off-by: Shivnandan Kumar <quic_kshivnan@quicinc.com>
This commit is contained in:
parent
f6646ebd13
commit
7d10568691
@ -1427,8 +1427,8 @@ int cpucp_memlat_init(struct scmi_device *sdev)
|
||||
return -EINVAL;
|
||||
|
||||
ops = sdev->handle->devm_protocol_get(sdev, SCMI_PROTOCOL_MEMLAT, &ph);
|
||||
if (!ops)
|
||||
return -ENODEV;
|
||||
if (IS_ERR(ops))
|
||||
return PTR_ERR(ops);
|
||||
|
||||
mutex_lock(&memlat_lock);
|
||||
memlat_data->ph = ph;
|
||||
|
Loading…
Reference in New Issue
Block a user