From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935363AbdJRHCB (ORCPT ); Wed, 18 Oct 2017 03:02:01 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:55278 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932290AbdJRHB6 (ORCPT ); Wed, 18 Oct 2017 03:01:58 -0400 X-Google-Smtp-Source: ABhQp+QcLK0kWwUzljuViGeYYb38kzi2KYespysjkbhpQX8qx4/R+QFa1VYTD+pTiMveVw0PlirH+A== Date: Wed, 18 Oct 2017 09:01:57 +0200 From: Johan Hovold To: Rob Herring Cc: Johan Hovold , Greg Kroah-Hartman , Jiri Slaby , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/2] serdev: ttyport: add missing open() error handling Message-ID: <20171018070157.GC5638@localhost> References: <20171016130620.5404-1-johan@kernel.org> <20171016130620.5404-2-johan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 17, 2017 at 11:08:53AM -0500, Rob Herring wrote: > On Mon, Oct 16, 2017 at 8:06 AM, Johan Hovold wrote: > > Add missing error handling for tty-driver open() which may fail (e.g. if > > resource allocation fails or if a port is being disconnected). > > > > Note that close() must be called also in case of failed open() and that > > the operation sanity check is amended to catch buggy drivers. > > That's a very odd pattern. Wouldn't a must_check annotation be enough? An odd pattern indeed, but that's how the TTY drivers are implemented and the interface documented (i.e. that close() will be called also after failed open()). Not sure how a must_check could help here. Johan