Thread (21 messages) 21 messages, 6 authors, 2021-01-28

Re: [PATCH v10] staging: fbtft: add tearing signal detect

From: Dan Carpenter <hidden>
Date: 2021-01-28 15:16:54
Also in: dri-devel, lkml

On Thu, Jan 28, 2021 at 12:32:22AM +0200, Kari Argillander wrote:
On Wed, Jan 27, 2021 at 09:42:52PM +0800, Carlis wrote:
quoted
@@ -82,6 +111,33 @@ enum st7789v_command {
  */
 static int init_display(struct fbtft_par *par)
 {
+	int rc;
+	struct device *dev = par->info->device;
+
+	par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0, GPIOD_IN);
+	if (IS_ERR(par->gpio.te)) {
+		rc = PTR_ERR(par->gpio.te);
+		dev_err(par->info->device, "Failed to request te gpio: %d\n", rc);
+		return rc;
+	}
You request with optinal and you still want to error out? We could just
continue and not care about that error. User will be happier if device
still works somehow.
Carlis tried that approach in previous versions.  See the discussion
about -EPROBEi_DEFER.

That's not the right way to think about it anyway.  It's optional but
the user *chose* to enable it so if an error occurs then it's still an
error and should be treated like an error.  The user should fix the
error or disable the feature if they want to continue.

There are lots of places in the kernel where the error handling could
be written to try continue but in a crippled state.  It's not the right
approach.  Over engineering like that just leads to bugs.

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help