Skip to content

Commit 21339b3

Browse files
Robert Richterdavejiang
authored andcommitted
cxl: Remove else after return
Remove unnecessary 'else' after return. Improves readability of code. It is easier to place comments. Check and fix all occurrences under drivers/cxl/. Signed-off-by: Robert Richter <[email protected]> Reviewed-by: Gregory Price <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Davidlohr Bueso <[email protected]> Reviewed-by: Alison Schofield <[email protected]> Reviewed-by: "Fabio M. De Francesco" <[email protected]> Tested-by: Gregory Price <[email protected]> Acked-by: Dan Williams <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent b443265 commit 21339b3

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

drivers/cxl/core/cdat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static u32 cdat_normalize(u16 entry, u64 base, u8 type)
2828
*/
2929
if (entry == 0xffff || !entry)
3030
return 0;
31-
else if (base > (UINT_MAX / (entry)))
31+
if (base > (UINT_MAX / (entry)))
3232
return 0;
3333

3434
/*

drivers/cxl/core/memdev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ static ssize_t security_state_show(struct device *dev,
153153
return sysfs_emit(buf, "frozen\n");
154154
if (state & CXL_PMEM_SEC_STATE_LOCKED)
155155
return sysfs_emit(buf, "locked\n");
156-
else
157-
return sysfs_emit(buf, "unlocked\n");
156+
157+
return sysfs_emit(buf, "unlocked\n");
158158
}
159159
static struct device_attribute dev_attr_security_state =
160160
__ATTR(state, 0444, security_state_show, NULL);

drivers/cxl/core/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm,
415415
*/
416416
if (global_ctrl & CXL_HDM_DECODER_ENABLE || (!hdm && info->mem_enabled))
417417
return devm_cxl_enable_mem(&port->dev, cxlds);
418-
else if (!hdm)
418+
419+
if (!hdm)
419420
return -ENODEV;
420421

421422
root = to_cxl_port(port->dev.parent);

drivers/cxl/core/region.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,10 @@ static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
231231
&cxlr->dev,
232232
"Bypassing cpu_cache_invalidate_memregion() for testing!\n");
233233
return 0;
234-
} else {
235-
dev_WARN(&cxlr->dev,
236-
"Failed to synchronize CPU cache state\n");
237-
return -ENXIO;
238234
}
235+
dev_WARN(&cxlr->dev,
236+
"Failed to synchronize CPU cache state\n");
237+
return -ENXIO;
239238
}
240239

241240
cpu_cache_invalidate_memregion(IORES_DESC_CXL);
@@ -1940,7 +1939,9 @@ static int cxl_region_attach(struct cxl_region *cxlr,
19401939
if (p->state > CXL_CONFIG_INTERLEAVE_ACTIVE) {
19411940
dev_dbg(&cxlr->dev, "region already active\n");
19421941
return -EBUSY;
1943-
} else if (p->state < CXL_CONFIG_INTERLEAVE_ACTIVE) {
1942+
}
1943+
1944+
if (p->state < CXL_CONFIG_INTERLEAVE_ACTIVE) {
19441945
dev_dbg(&cxlr->dev, "interleave config missing\n");
19451946
return -ENXIO;
19461947
}

0 commit comments

Comments
 (0)