diff --git a/drivers/extcon/extcon-usbc-cros-ec.c b/drivers/extcon/extcon-usbc-cros-ec.c index e759ed4777352d38273c15c859aeee9a2124cdcb..598956f1dcae61a6928f965a996836afcee1cc20 100644 --- a/drivers/extcon/extcon-usbc-cros-ec.c +++ b/drivers/extcon/extcon-usbc-cros-ec.c @@ -68,6 +68,8 @@ static int cros_ec_pd_command(struct cros_ec_extcon_info *info, int ret; msg = kzalloc(sizeof(*msg) + max(outsize, insize), GFP_KERNEL); + if (!msg) + return -ENOMEM; msg->version = version; msg->command = command;