Skip to contentSkip to conversation

mtd: parsers: qcom: Fix error condition

PATCH Applied Miquel Raynal 1 participant 2 messages Mar 3, 2021 – Mar 11, 2021

Subsystems (2)
lore
Share & tools
lore

Miquel Raynal

author maintainer
#0 lore raw

PATCH 1/1 mtd: parsers: qcom: Fix error condition

qcom_smem_get() does not return NULL, and even if it did, the NULL condition is usually not an error but a success condition and should not trigger an error trace.

Let's replace IS_ERR_OR_NULL() by IS_ERR().

This fixes the following smatch warning:
drivers/mtd/parsers/qcomsmempart.c:109 parse_qcomsmem_part() warn: passing zero to 'PTR_ERR'

Fixes 803eb124e1a6 ("mtd: parsers: Add Qcom SMEM parser")
---
 drivers/mtd/parsers/qcomsmempart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/parsers/qcomsmempart.c +1 -1
index 808cb33d71f8..1c8a44d0d6e4 100644
@@ -104,7 +104,7 @@ static int parse_qcomsmem_part(struct mtd_info *mtd,
 	 * complete partition table
 	 */
 	ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len);
-	if (IS_ERR_OR_NULL(ptable)) {
+	if (IS_ERR(ptable)) {
 		pr_err("Error reading partition table\n");
 		return PTR_ERR(ptable);
 	}
Signature · 6 lines
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author maintainer Applied
#1 lore raw
Quoted 6 lines · Miquel Raynal

qcom_smem_get() does not return NULL, and even if it did, the NULL condition is usually not an error but a success condition and should not trigger an error trace.

Let's replace IS_ERR_OR_NULL() by IS_ERR().

Quoted 7 lines

This fixes the following smatch warning:
drivers/mtd/parsers/qcomsmempart.c:109 parse_qcomsmem_part() warn: passing zero to 'PTR_ERR'

Fixes 803eb124e1a6 ("mtd: parsers: Add Qcom SMEM parser")

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/