Debug a piece of code written in Python.
def say_hello(name):
    message = "Hello %s!" % name
    print(message)

say_hello('John')
def say_hello(name):
    message = "Hello %s!" % name
    print(message)

# checking for input
if name != '':
    say_hello(name)
else:
    print('Error: No name provided')