Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: i2c: mt9v111: Use %pe format specifier

The %pe format specifier is designed to print error pointers. It prints
a symbolic error name (eg. -EINVAL) and it makes the code simpler by
omitting PTR_ERR().

This patch fixes this cocci report:
./i2c/mt9v111.c:1143:3-10: WARNING: Consider using %pe to print PTR_ERR()
./i2c/mt9v111.c:1151:3-10: WARNING: Consider using %pe to print PTR_ERR()
./i2c/mt9v111.c:1159:3-10: WARNING: Consider using %pe to print PTR_ERR()

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Ricardo Ribalda and committed by
Hans Verkuil
b97ef7b6 e027f53e

+6 -6
+6 -6
drivers/media/i2c/mt9v111.c
··· 1139 1139 mt9v111->oe = devm_gpiod_get_optional(&client->dev, "enable", 1140 1140 GPIOD_OUT_LOW); 1141 1141 if (IS_ERR(mt9v111->oe)) { 1142 - dev_err(&client->dev, "Unable to get GPIO \"enable\": %ld\n", 1143 - PTR_ERR(mt9v111->oe)); 1142 + dev_err(&client->dev, "Unable to get GPIO \"enable\": %pe\n", 1143 + mt9v111->oe); 1144 1144 return PTR_ERR(mt9v111->oe); 1145 1145 } 1146 1146 1147 1147 mt9v111->standby = devm_gpiod_get_optional(&client->dev, "standby", 1148 1148 GPIOD_OUT_HIGH); 1149 1149 if (IS_ERR(mt9v111->standby)) { 1150 - dev_err(&client->dev, "Unable to get GPIO \"standby\": %ld\n", 1151 - PTR_ERR(mt9v111->standby)); 1150 + dev_err(&client->dev, "Unable to get GPIO \"standby\": %pe\n", 1151 + mt9v111->standby); 1152 1152 return PTR_ERR(mt9v111->standby); 1153 1153 } 1154 1154 1155 1155 mt9v111->reset = devm_gpiod_get_optional(&client->dev, "reset", 1156 1156 GPIOD_OUT_LOW); 1157 1157 if (IS_ERR(mt9v111->reset)) { 1158 - dev_err(&client->dev, "Unable to get GPIO \"reset\": %ld\n", 1159 - PTR_ERR(mt9v111->reset)); 1158 + dev_err(&client->dev, "Unable to get GPIO \"reset\": %pe\n", 1159 + mt9v111->reset); 1160 1160 return PTR_ERR(mt9v111->reset); 1161 1161 } 1162 1162