am64x/am243x: SDFM: Remove duplicate checks

- Return a null pointer instead of assigning null value to a local pointer
- Remove duplicate checks

Fixes: PINDSW-7460

Signed-off-by: Achala Ram <a-ram@ti.com>
This commit is contained in:
Achala Ram 2024-01-05 17:32:52 +05:30
parent 17fdd76f13
commit 2a25701324

View File

@ -73,7 +73,7 @@ sdfm_handle SDFM_init(uint8_t pru_id, uint8_t coreId)
} }
else else
{ {
p_sdfm->p_sdfm_interface = NULL; return NULL;
} }
/* Set FW PRU ID */ /* Set FW PRU ID */
@ -99,14 +99,14 @@ sdfm_handle SDFM_init(uint8_t pru_id, uint8_t coreId)
} }
else else
{ {
p_sdfm->p_sdfm_interface = NULL; return NULL;
} }
/* Set FW PRU ID */ /* Set FW PRU ID */
p_sdfm->p_sdfm_interface->sdfm_ctrl.sdfm_pru_id = pru_id; p_sdfm->p_sdfm_interface->sdfm_ctrl.sdfm_pru_id = pru_id;
} }
else else
{ {
p_sdfm = NULL; return NULL;
} }
return (sdfm_handle)p_sdfm; return (sdfm_handle)p_sdfm;
@ -288,7 +288,7 @@ int32_t SDFM_getFastDetectErrorStatus(sdfm_handle h_sdfm, uint8_t chNum)
uint8_t pwmSet; uint8_t pwmSet;
int32_t retVal = SystemP_SUCCESS; int32_t retVal = SystemP_SUCCESS;
PRUICSS_Handle pruIcssHandle = h_sdfm->gPruIcssHandle; PRUICSS_Handle pruIcssHandle = h_sdfm->gPruIcssHandle;
if((chNum >= SDFM_CHANNEL0) && (chNum < SDFM_CHANNEL3)) if(chNum < SDFM_CHANNEL3)
{ {
pwmSet = 0; pwmSet = 0;
} }
@ -346,7 +346,7 @@ int32_t SDFM_clearPwmTripStatus(sdfm_handle h_sdfm, uint8_t chNum)
int32_t retVal = SystemP_SUCCESS; int32_t retVal = SystemP_SUCCESS;
PRUICSS_Handle pruIcssHandle = h_sdfm->gPruIcssHandle; PRUICSS_Handle pruIcssHandle = h_sdfm->gPruIcssHandle;
if((chNum >= SDFM_CHANNEL0) && (chNum < SDFM_CHANNEL3)) if(chNum < SDFM_CHANNEL3)
{ {
pwmSet = 0; pwmSet = 0;
} }
@ -479,7 +479,7 @@ int32_t SDFM_clearOverCurrentError(sdfm_handle h_sdfm, uint8_t chNum)
uint8_t pwmSet; uint8_t pwmSet;
int32_t retVal = SystemP_SUCCESS; int32_t retVal = SystemP_SUCCESS;
PRUICSS_Handle pruIcssHandle = h_sdfm->gPruIcssHandle; PRUICSS_Handle pruIcssHandle = h_sdfm->gPruIcssHandle;
if((chNum >= SDFM_CHANNEL0) && (chNum < SDFM_CHANNEL3)) if(chNum < SDFM_CHANNEL3)
{ {
pwmSet = 0; pwmSet = 0;
} }