Linux CXL
 help / color / mirror / Atom feed
* [PATCH 1/2] cxl/hdm: Fix && vs || bug
@ 2023-10-31  9:53 Dan Carpenter
  2023-10-31  9:54 ` [PATCH 2/2] cxl/hdm: add unlock on error path Dan Carpenter
  2023-10-31 11:02 ` [PATCH 1/2] cxl/hdm: Fix && vs || bug Robert Richter
  0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-10-31  9:53 UTC (permalink / raw)
  To: Robert Richter
  Cc: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams, Terry Bowman, linux-cxl,
	linux-kernel, kernel-janitors

If "info" is NULL then this code will crash.  || was intended instead of
&&.

Fixes: 8ce520fdea24 ("cxl/hdm: Use stored Component Register mappings to map HDM decoder capability")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/cxl/core/hdm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index bc8ad4a8afca..af17da8230d5 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -146,7 +146,7 @@ struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
 
 	/* Memory devices can configure device HDM using DVSEC range regs. */
 	if (reg_map->resource == CXL_RESOURCE_NONE) {
-		if (!info && !info->mem_enabled) {
+		if (!info || !info->mem_enabled) {
 			dev_err(dev, "No component registers mapped\n");
 			return ERR_PTR(-ENXIO);
 		}
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-31 22:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31  9:53 [PATCH 1/2] cxl/hdm: Fix && vs || bug Dan Carpenter
2023-10-31  9:54 ` [PATCH 2/2] cxl/hdm: add unlock on error path Dan Carpenter
2023-10-31 21:17   ` Dan Williams
2023-10-31 21:47     ` Dave Jiang
2023-10-31 22:04     ` Ira Weiny
2023-10-31 11:02 ` [PATCH 1/2] cxl/hdm: Fix && vs || bug Robert Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox