Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp50570ybg; Mon, 8 Jun 2020 16:09:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf1sXvGDKdAAeOQvZVxKE+lF5JeXI4/XxQ0B7GiIb1MrfTN3BLQFhOJ69d7na/FdUfINve X-Received: by 2002:a50:d78f:: with SMTP id w15mr24938637edi.245.1591657776676; Mon, 08 Jun 2020 16:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591657776; cv=none; d=google.com; s=arc-20160816; b=fjNNAWe59TEtUEDgT7B9ddIdkCBqt0FSLhlRcCTK1J9Bkr5oyVCJ7D5G94RwJV/EgX OFSaO6AnrsjBm7aWL250cNjxRo4DUsrYRFw3rwtQNJV1f6o1IfPHWh0TuMIbKH6OQo2i XekVERVf9V8fK93FDObK66EtPLDOopMoxcNBabYan8BOqFXL01tdMWzwaUXuARXU1+bI P2j/RRL1L7DpraRq6GihVecscpB7fabU+rGSfmXU3+//6J+Dy+VdrERMXxlfIMeS59VY AAqexes2dAC72u6n5X6Kjn+bVLvnj5kNlfl7a/g+6gLQ9X8+9mRl8kQVFudx/3E5URPV 5hmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=URmJeZnPNEqPW7QN7DJetkZ0p8bY735O0JZ9RsWLSMk=; b=Ui07ZIu0Vg0gCwGilpQzwQr5w4yW+JOefs4sFrFXfw+Aq93dKQqJRnd0ZxMLw7B34Q mIvdddNwfe4GTyDBMRoIBVPdEZWEGkONrvQJHFqvoF49DNh7pMv8nhOcvuRVw/sCSrIi j6Pd6cPSK5VLr1RnaOIM2X2deYFIIlRFX6+IsPdzrqP/KpXEI3QnFO0QvV7R3chqKHF7 9c6/3vZrskeU7CVAffBWV+HgmkcD+Y+fJaHI8lpmVF+voaWP4hBfKUxfnWgCI7kF2OZu uXC270qXqI/auKPNPdEWuhakPUfEp/lTnUd8sWRbVXn++pelgoMnGxZRRJasTfnJdMJe +qNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nXHZGou2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si10387203edj.441.2020.06.08.16.09.13; Mon, 08 Jun 2020 16:09:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nXHZGou2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgFHXG5 (ORCPT + 99 others); Mon, 8 Jun 2020 19:06:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:49762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727010AbgFHXGd (ORCPT ); Mon, 8 Jun 2020 19:06:33 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 542F02076C; Mon, 8 Jun 2020 23:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657593; bh=URSM4OVSd3VdBQHRpH5PXvzyY3qrWEOKrHQAtea9Itk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nXHZGou2DqBTPFsVuY9HKXlHWZI4PBVsyeu6721ZO61faGWNpMRl1Z0fx4cSidQF4 TLvkYWZsqf+59prx3C6SLFxYbS0mkU0J0q8tY80j4Uo8KCn/sgUmSrq7fFDlipHLxh YkjifqmuTae5/xkopQhEJ3Nv3bvpUqSOEPH2YjGE= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Enric Balletbo i Serra , Laurent Pinchart , Sam Ravnborg , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.7 020/274] drm/bridge: panel: Return always an error pointer in drm_panel_bridge_add() Date: Mon, 8 Jun 2020 19:01:53 -0400 Message-Id: <20200608230607.3361041-20-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Enric Balletbo i Serra [ Upstream commit 30be3031087139061de4421bf52015931eaab569 ] Since commit 89958b7cd955 ("drm/bridge: panel: Infer connector type from panel by default"), drm_panel_bridge_add() and their variants can return NULL and an error pointer. This is fine but none of the actual users of the API are checking for the NULL value. Instead of change all the users, seems reasonable to return an error pointer instead. So change the returned value for those functions when the connector type is unknown. Suggested-by: Laurent Pinchart Signed-off-by: Enric Balletbo i Serra Reviewed-by: Laurent Pinchart Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20200416210654.2468805-1-enric.balletbo@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/panel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 8461ee8304ba..7a3df0f319f3 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -166,7 +166,7 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { * * The connector type is set to @panel->connector_type, which must be set to a * known type. Calling this function with a panel whose connector type is - * DRM_MODE_CONNECTOR_Unknown will return NULL. + * DRM_MODE_CONNECTOR_Unknown will return ERR_PTR(-EINVAL). * * See devm_drm_panel_bridge_add() for an automatically managed version of this * function. @@ -174,7 +174,7 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel) { if (WARN_ON(panel->connector_type == DRM_MODE_CONNECTOR_Unknown)) - return NULL; + return ERR_PTR(-EINVAL); return drm_panel_bridge_add_typed(panel, panel->connector_type); } @@ -265,7 +265,7 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, struct drm_panel *panel) { if (WARN_ON(panel->connector_type == DRM_MODE_CONNECTOR_Unknown)) - return NULL; + return ERR_PTR(-EINVAL); return devm_drm_panel_bridge_add_typed(dev, panel, panel->connector_type); -- 2.25.1