https://github.com/torvalds/linux
Revision 641e3fd1a038c68045bbf89d78502f4b4bbc7284 authored by Uwe Kleine-König on 19 October 2021, 20:49:16 UTC, committed by David S. Miller on 20 October 2021, 13:41:20 UTC
If something goes wrong in the remove callback, returning an error code
just results in an error message. The device still disappears.

So don't skip disabling the regulator in st95hf_remove() if resetting
the controller via spi fails. Also don't return an error code which just
results in two error messages.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 323e9a9
Raw File
Tip revision: 641e3fd1a038c68045bbf89d78502f4b4bbc7284 authored by Uwe Kleine-König on 19 October 2021, 20:49:16 UTC
nfc: st95hf: Make spi remove() callback return zero
Tip revision: 641e3fd
checkdeclares.pl
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
#
# checkdeclares: find struct declared more than once
#
# Copyright 2021 Wan Jiabing<wanjiabing@vivo.com>
# Inspired by checkincludes.pl
#
# This script checks for duplicate struct declares.
# Note that this will not take into consideration macros so
# you should run this only if you know you do have real dups
# and do not have them under #ifdef's.
# You could also just review the results.

use strict;

sub usage {
	print "Usage: checkdeclares.pl file1.h ...\n";
	print "Warns of struct declaration duplicates\n";
	exit 1;
}

if ($#ARGV < 0) {
	usage();
}

my $dup_counter = 0;

foreach my $file (@ARGV) {
	open(my $f, '<', $file)
	    or die "Cannot open $file: $!.\n";

	my %declaredstructs = ();

	while (<$f>) {
		if (m/^\s*struct\s*(\w*);$/o) {
			++$declaredstructs{$1};
		}
	}

	close($f);

	foreach my $structname (keys %declaredstructs) {
		if ($declaredstructs{$structname} > 1) {
			print "$file: struct $structname is declared more than once.\n";
			++$dup_counter;
		}
	}
}

if ($dup_counter == 0) {
	print "No duplicate struct declares found.\n";
}
back to top