#include "power_state.h"
#include "eventmanager.h"
+#define PP_CHECK(handle) \
+ do { \
+ if ((handle) == NULL || (handle)->pp_valid != PP_VALID) \
+ return -EINVAL; \
+ } while (0)
+
static int pp_early_init(void *handle)
{
return 0;
if (handle == NULL)
return -ENOMEM;
+ handle->pp_valid = PP_VALID;
+
ret = smum_init(pp_init, handle);
if (ret)
goto fail_smum;
struct pp_hwmgr *hwmgr;
const struct amd_pp_display_configuration *display_config = input;
- if (handle == NULL)
- return -EINVAL;
+ PP_CHECK((struct pp_instance *)handle);
hwmgr = ((struct pp_instance *)handle)->hwmgr;
{
struct pp_hwmgr *hwmgr;
- if (handle == NULL || output == NULL)
+ PP_CHECK((struct pp_instance *)handle);
+
+ if (output == NULL)
return -EINVAL;
hwmgr = ((struct pp_instance *)handle)->hwmgr;